/// <summary> /// Метод расширения, добавляющий сервисы из domain для DI /// </summary> /// <param name="service"></param> /// <returns></returns> public static IServiceCollection AddDomainServices(this IServiceCollection service, Action <HotelOptions> opt) { var options = new HotelOptions(); opt(options); service.AddSingleton(options); service.AddScoped <IUserService, UserService>(); service.AddScoped <IAuthorizationService, AuthorizationService>(); service.AddScoped <IRoomService, RoomService>(); service.AddScoped <IVisitorService, VisitorService>(); return(service); }
public VisitorService(DatabaseContext context, IRoomService roomService, IUserService userService, HotelOptions hotelOptions) { _context = context; _roomService = roomService; _userService = userService; _hotelOptions = hotelOptions; _prices = new Dictionary <RoomOptions, int> { { RoomOptions.Standard, _hotelOptions.PriceForStandard }, { RoomOptions.HalfLux, _hotelOptions.PriceForHalfLux }, { RoomOptions.Lux, _hotelOptions.PriceForLux }, }; }
public DefaultDateLogicService(IOptions <HotelOptions> optionsAccessor) { _hotelOptions = optionsAccessor.Value; }
public RoomService(DatabaseContext context, HotelOptions options) { _context = context; _options = options; }