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
// Defining a Shadow Property | |
public class ApplicationDbContext : DbContext | |
{ | |
public DbSet<Book> Books { get; set; } | |
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<Book>().Property<DateTime>("ModifiedDate"); | |
} | |
} |
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
// Defining a Shadow Property | |
public class ApplicationDbContext : DbContext | |
{ | |
public DbSet<Book> Books { get; set; } | |
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<Book>().Property<DateTime>("ModifiedDate"); | |
} |
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
public class ApplicationDbContext : DbContext | |
{ | |
public DbSet<Book> Books { get; set; } | |
protected override void OnModelCreating(ModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<Book>().Property<DateTime>("ModifiedDate"); | |
} | |
} | |
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
namespace DotNetCoreRepository.Repository | |
{ | |
public class EmployeeRepository : IEmployeeRepository | |
{ | |
private readonly IConfiguration configuration; | |
public EmployeeRepository(IConfiguration configuration) | |
{ | |
this.configuration = configuration; | |
} | |
public void AddUpdateEmployee(EmployeeModel em) |
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
using Dapper; | |
using Microsoft.Extensions.Configuration; | |
using <YourProjectName>.Application.Interfaces; | |
using <YourProjectName>.Core.Models; | |
using System; | |
using System.Collections.Generic; | |
using System.Data.SqlClient; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace <YourProjectName>.Infrastructure.Repositories |
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
using Dapper; | |
using Microsoft.Extensions.Configuration; | |
using <YourProjectName>.Application.Interfaces; | |
using <YourProjectName>.Core.Models; | |
using System; | |
using System.Collections.Generic; | |
using System.Data.SqlClient; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace <YourProjectName>.Infrastructure.Repositories |
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
using System.Text.Json; | |
using controllers.ApiModels; | |
using Microsoft.AspNetCore.Mvc; | |
namespace controllers.Controllers; | |
[ApiController] | |
[Route("Demo")] | |
public class DemoController : ControllerBase | |
{ |
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
version: '3' | |
services: | |
catalog.api: | |
ports: | |
- 4000:4300 | |
depends_on: | |
- catalog.db | |
environment: | |
- MONGO_URL=catalogdb:27017 | |
catalog.db: |
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
version: '3' | |
services: | |
catalog.api: | |
image: catalogapi | |
container_name: catalogapi | |
build: | |
context: ./Catalog.Api | |
dockerfile: dockerfile | |
catalog.db: |
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
[HttpPost("UpdateBasketItems")] | |
public async Task<Basket.Api.Models.Basket?> UpdateBasketItems(Basket.Api.Models.Basket basket) | |
{ | |
using var channel = GrpcChannel.ForAddress(_configuration.GetValue<string>("DiscountGrpcServerUrl")); | |
var client = new Price.PriceClient(channel); | |
foreach (var item in basket.BasketItems) | |
{ | |
var reply = await client.GetPriceAsync(new PriceRequest() { Id = item.ProductId }); | |
if (!string.IsNullOrEmpty(reply.ErrorMessage)) |
NewerOlder