AddCartService

This commit is contained in:
Damillora 2021-03-24 17:28:45 +07:00
parent 2b00319e87
commit f51c2623c8
2 changed files with 3 additions and 3 deletions

View File

@ -15,9 +15,9 @@ namespace TestAppRuna.API
[ApiController] [ApiController]
public class CartController : ControllerBase public class CartController : ControllerBase
{ {
public CartService CartSvc { get; } public ICartService CartSvc { get; }
public CartController(CartService cartSvc) public CartController(ICartService cartSvc)
{ {
this.CartSvc = cartSvc; this.CartSvc = cartSvc;
} }

View File

@ -35,7 +35,7 @@ namespace TestAppRuna
services.AddSingleton<WeatherForecastService>(); services.AddSingleton<WeatherForecastService>();
services.AddScoped<IMathService, MathService>(); services.AddScoped<IMathService, MathService>();
services.AddScoped<ICartService, CartService>();
services.Configure<AppSettings>(Configuration); services.Configure<AppSettings>(Configuration);
services.AddScoped<AppSettings>(di => di.GetRequiredService<IOptionsMonitor<AppSettings>>().CurrentValue); services.AddScoped<AppSettings>(di => di.GetRequiredService<IOptionsMonitor<AppSettings>>().CurrentValue);