Example #1
0
        public async Task Add(ParkingAddParams param)
        {
            var ownerParam = mapper.Map <ParkingAddParams, ParkingAddWithOwnerParams>(param);

            ownerParam.OwnerId = HttpContext.User.GetId();
            var parking = mapper.Map <ParkingAddWithOwnerParams, Parking>(ownerParam);
            await parkingRepository.AddAsync(parking);

            await uow.CommitAsync();
        }
        public async Task StartAsync(Guid userID, ParkingModel model)
        {
            var parkModel = await GetParkModel(userID, model);

            await IsParked(parkModel.CompanyID, parkModel.VehicleID, true);
            await HasExceededLimit(parkModel.CompanyID, parkModel.TypeID, parkModel.QtdCars, parkModel.QtdMotorcycles);

            await _parkingRepository.AddAsync(new Parking { ID = Guid.NewGuid(), CompanyID = parkModel.CompanyID, StartDate = DateTimeOffset.UtcNow, VehicleID = parkModel.VehicleID, TypeID = parkModel.TypeID });

            await _parkingRepository.SaveChangeAsync();
        }