-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
77 changed files
with
1,223 additions
and
36 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
dotnetproject/dotnetmicroservicetwo/Controllers/ChannelController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.EntityFrameworkCore; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using dotnetmicroservicetwo.Models; | ||
|
||
namespace dotnetmicroservicetwo.Controllers | ||
{ | ||
[Route("api/[controller]")] | ||
[ApiController] | ||
public class ChannelController : ControllerBase | ||
{ | ||
private readonly ChannelDbContext _context; | ||
|
||
public ChannelController(ChannelDbContext context) | ||
{ | ||
_context = context; | ||
} | ||
|
||
[HttpGet] | ||
public async Task<ActionResult<IEnumerable<Channel>>> GetAllChannels() | ||
{ | ||
var channels = await _context.Channels.ToListAsync(); | ||
return Ok(channels); | ||
} | ||
[HttpGet("ChannelNames")] | ||
public async Task<ActionResult<IEnumerable<string>>> Get() | ||
{ | ||
// Project the ChannelTitle property using Select | ||
var ChannelNames = await _context.Channels | ||
.OrderBy(x => x.ChannelName) | ||
.Select(x => x.ChannelName) | ||
.ToListAsync(); | ||
|
||
return ChannelNames; | ||
} | ||
[HttpPost] | ||
public async Task<ActionResult> AddChannel(Channel channel) | ||
{ | ||
if (!ModelState.IsValid) | ||
{ | ||
return BadRequest(ModelState); // Return detailed validation errors | ||
} | ||
await _context.Channels.AddAsync(channel); | ||
await _context.SaveChangesAsync(); | ||
return Ok(); | ||
} | ||
[HttpDelete("{id}")] | ||
public async Task<IActionResult> DeleteChannel(int id) | ||
{ | ||
if (id <= 0) | ||
return BadRequest("Not a valid Channel id"); | ||
|
||
var channel = await _context.Channels.FindAsync(id); | ||
_context.Channels.Remove(channel); | ||
await _context.SaveChangesAsync(); | ||
return NoContent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace dotnetmicroservicetwo.Models; | ||
public class Channel | ||
{ | ||
public int ChannelID { get; set; } | ||
|
||
public string? ChannelName { get; set; } | ||
|
||
public string? POCName { get; set; } | ||
|
||
public decimal? CommercialPerAd { get; set; } | ||
|
||
public string? MailID { get; set; } | ||
public string? ContactNumber { get; set; } | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
dotnetproject/dotnetmicroservicetwo/Models/ChannelDbContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace dotnetmicroservicetwo.Models; | ||
|
||
public class ChannelDbContext : DbContext | ||
{ | ||
|
||
public ChannelDbContext(DbContextOptions<ChannelDbContext> options) | ||
: base(options) | ||
{ | ||
} | ||
public virtual DbSet<Channel> Channels { get; set; } | ||
} |
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
dotnetproject/dotnetmicroservicetwo/Models/SongDbContext.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file added
BIN
+299 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Azure.Identity.dll
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+14.4 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Bcl.AsyncInterfaces.dll
Binary file not shown.
Binary file added
BIN
+269 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Data.SqlClient.dll
Binary file not shown.
Binary file added
BIN
+34 KB
...ect/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.EntityFrameworkCore.Abstractions.dll
Binary file not shown.
Binary file added
BIN
+397 KB
...etproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.EntityFrameworkCore.Design.dll
Binary file not shown.
Binary file added
BIN
+201 KB
...project/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.EntityFrameworkCore.InMemory.dll
Binary file not shown.
Binary file added
BIN
+1.76 MB
...oject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.EntityFrameworkCore.Relational.dll
Binary file not shown.
Binary file added
BIN
+476 KB
...roject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.EntityFrameworkCore.SqlServer.dll
Binary file not shown.
Binary file added
BIN
+1.99 MB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.EntityFrameworkCore.dll
Binary file not shown.
Binary file added
BIN
+31.1 KB
...ject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.Caching.Abstractions.dll
Binary file not shown.
Binary file added
BIN
+42.6 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.Caching.Memory.dll
Binary file not shown.
Binary file added
BIN
+28.6 KB
...otnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.Configuration.Abstractions.dll
Binary file not shown.
Binary file added
BIN
+44.1 KB
...icroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll
Binary file not shown.
Binary file added
BIN
+83.2 KB
...oject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.DependencyInjection.dll
Binary file not shown.
Binary file added
BIN
+79.1 KB
...etproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.DependencyModel.dll
Binary file not shown.
Binary file added
BIN
+62.6 KB
...ject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.Logging.Abstractions.dll
Binary file not shown.
Binary file added
BIN
+47.1 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.Logging.dll
Binary file not shown.
Binary file added
BIN
+60.1 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.Options.dll
Binary file not shown.
Binary file added
BIN
+41.6 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Extensions.Primitives.dll
Binary file not shown.
Binary file added
BIN
+61.5 KB
...ject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Identity.Client.Extensions.Msal.dll
Binary file not shown.
Binary file added
BIN
+1.39 MB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Identity.Client.dll
Binary file not shown.
Binary file added
BIN
+18.4 KB
...etproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.IdentityModel.Abstractions.dll
Binary file not shown.
Binary file added
BIN
+87.4 KB
...tproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.IdentityModel.JsonWebTokens.dll
Binary file not shown.
Binary file added
BIN
+33.4 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.IdentityModel.Logging.dll
Binary file not shown.
Binary file added
BIN
+111 KB
...otnetmicroservicetwo/bin/Debug/net6.0/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll
Binary file not shown.
Binary file added
BIN
+37.4 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.IdentityModel.Protocols.dll
Binary file not shown.
Binary file added
BIN
+960 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.IdentityModel.Tokens.dll
Binary file not shown.
Binary file added
BIN
+23.4 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.SqlServer.Server.dll
Binary file not shown.
Binary file added
BIN
+25.6 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Microsoft.Win32.SystemEvents.dll
Binary file not shown.
Binary file added
BIN
+112 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/Mono.TextTemplating.dll
Binary file not shown.
Binary file added
BIN
+183 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.CodeDom.dll
Binary file not shown.
Binary file added
BIN
+387 KB
...ject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Configuration.ConfigurationManager.dll
Binary file not shown.
Binary file added
BIN
+171 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Drawing.Common.dll
Binary file not shown.
Binary file added
BIN
+88.4 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.IdentityModel.Tokens.Jwt.dll
Binary file not shown.
Binary file added
BIN
+20.9 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Memory.Data.dll
Binary file not shown.
Binary file added
BIN
+87.1 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Runtime.Caching.dll
Binary file not shown.
Binary file added
BIN
+20.1 KB
...ect/dotnetmicroservicetwo/bin/Debug/net6.0/System.Security.Cryptography.ProtectedData.dll
Binary file not shown.
Binary file added
BIN
+102 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Security.Permissions.dll
Binary file not shown.
Binary file added
BIN
+69.6 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Text.Encodings.Web.dll
Binary file not shown.
Binary file added
BIN
+531 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Text.Json.dll
Binary file not shown.
Binary file added
BIN
+25.1 KB
dotnetproject/dotnetmicroservicetwo/bin/Debug/net6.0/System.Windows.Extensions.dll
Binary file not shown.
Oops, something went wrong.