Ejemplo n.º 1
0
 public UsersTests()
 {
     this.apiConfig       = new FakeIOptions();
     this.logger          = new FakeLogger <UsersController>();
     this.failingApiCalls = new FakeFailingApiCalls();
     this.usersApiCalls   = new FakeRoomsApiCalls();
 }
Ejemplo n.º 2
0
 public NotificationRepositoryTests()
 {
     this.logger          = new FakeLogger <NotificationsController>();
     this.apiConfig       = new FakeIOptions();
     this.apiCalls        = new FakeNotificationsApiCalls();
     this.failingApiCalls = new FakeFailingApiCalls();
 }
 public UsersRepository(IOptions <ApiConfig> apiConfig, ILogger <UsersController> logger, IApiCalls apiCalls)
 {
     _apiCalls      = apiCalls;
     this.apiConfig = apiConfig.Value;
     _logger        = logger;
     apiCall        = new JObject();
 }
 public RoomRepository(IOptions <ApiConfig> apiConfig, ILogger <RoomsController> logger, IApiCalls apiCalls)
 {
     this.apiCalls  = apiCalls;
     this.apiConfig = apiConfig.Value;
     this.logger    = logger;
     rooms          = GetAll();
 }
 public HomeCredentials(IOptions <ApiConfig> apiConfig, ILogger <HomeController> logger)
 {
     apiCalls       = new ApiCalls();
     this.apiConfig = apiConfig.Value;
     _logger        = logger;
     apiCall        = new JObject();
 }
 public RoomScheduleTests()
 {
     this.logger          = new FakeLogger <ScheduleController>();
     this.apiConfig       = new FakeIOptions();
     this.apiCalls        = new FakeScheduleApiCalls();
     this.failingApiCalls = new FakeFailingApiCalls();
 }
        private async Task <ActionResult <CommandLogDto> > UpdateDb(IApiCalls apiCalls)
        {
            DateTime lastUpdateTime = _repo.GetLatestLog().LastUpdate;

            if (DateTime.Now < lastUpdateTime.AddHours(1))
            {
                return(NoContent());
            }

            _repo.ClearListings();
            IEnumerable <Listing> listingsToAdd = await apiCalls.GetAllListings();

            _repo.AddListings(listingsToAdd);

            CommandLog commandLog = new CommandLog();

            commandLog.Deleted         = (_repo.GetRecipePricesCount() + _repo.GetTpPricesCount());
            commandLog.CommandExecuted = "update";
            commandLog.LastUpdate      = DateTime.Now;
            commandLog.Inserted        = _repo.GetListingsCount();
            _repo.AddCommandLog(commandLog);

            SetAllRecipesCreationPrice();

            if (_repo.SaveChanges())
            {
                //return NotFound();
                CommandLogDto commandLogDto = _mapper.Map <CommandLogDto>(commandLog);
                //TODO: change to add rout in response header
                return(Ok(commandLogDto));
            }

            return(NotFound());
        }
 public RoomRepositoryTests()
 {
     this.apiConfig       = new FakeIOptions();
     this.logger          = new FakeLogger <RoomsController>();
     this.failingApiCalls = new FakeFailingApiCalls();
     this.roomsApiCalls   = new FakeRoomsApiCalls();
 }
Ejemplo n.º 9
0
 public KeyValueItem(IApiCalls <Brand> brandApiCalls, IApiCalls <Model> modelApiCalls, IApiCalls <Fuel> fuelApiCalls, IApiCalls <TransmisionType> transmisionApiCalls, IApiCalls <Location> locationApiCalls)
 {
     _brandApiCalls        = brandApiCalls;
     _modelApiCalls        = modelApiCalls;
     _fuelApiCalls         = fuelApiCalls;
     _transmissionApiCalls = transmisionApiCalls;
     _locationApiCalls     = locationApiCalls;
 }
Ejemplo n.º 10
0
 public NotificationRepository(IApiCalls apiCalls, IOptions <ApiConfig> apiConfig, ILogger <NotificationsController> logger)
 {
     this.apiCalls  = apiCalls;
     this.apiConfig = apiConfig.Value;
     this.logger    = logger;
 }
Ejemplo n.º 11
0
 public RoomSchedule(IOptions <ApiConfig> apiConfig, ILogger <ScheduleController> logger, IApiCalls apiCalls)
 {
     this.apiCalls  = apiCalls;
     this.apiConfig = apiConfig.Value;
     this.logger    = logger;
 }
Ejemplo n.º 12
0
 public LocationController(IApiCalls <Location> apiCall)
 {
     _locationApiCall = apiCall;
 }
Ejemplo n.º 13
0
 public UICarController(IApiCalls <Car> apiGetCalls, UserManager <IdentityUser> userManager, IKeyValueItem keyValueItem)
 {
     _carApiGetCall = apiGetCalls;
     _userManager   = userManager;
     _keyValueItem  = keyValueItem;
 }
Ejemplo n.º 14
0
 public BookingController(IApiCalls <Booking> apiCalls, IApiCalls <Location> locationApiCall)
 {
     _bookingApiCalls = apiCalls;
     _locationApiCall = locationApiCall;
 }
Ejemplo n.º 15
0
        public async Task <ActionResult <CommandLogDto> > PostExeuteCommand(ExecuteCommandReadDto commandDto, [FromServices] IApiCalls apiCalls)
        {
            ExecuteCommand command = _mapper.Map <ExecuteCommandReadDto, ExecuteCommand>(commandDto);

            if (command == null)
            {
                return(BadRequest());
            }


            switch (command.Command)
            {
            case "update":
                return(await UpdateDb(apiCalls));

            default:
                return(BadRequest());
            }
        }
Ejemplo n.º 16
0
 public FuelController(IApiCalls <Fuel> apiGetCalls)
 {
     _apiGetCalls = apiGetCalls;
 }
Ejemplo n.º 17
0
 public BrandController(IApiCalls <Brand> brandApiCall, IApiCalls <Model> modelApiCalls)
 {
     this._brandApiCall = brandApiCall;
     this._modelApiCall = modelApiCalls;
 }
Ejemplo n.º 18
0
 public AspNetUsersController(IApiCalls <AspNetUsers> apiCalls)
 {
     this._apiCalls = apiCalls;
 }