Esempio n. 1
0
        public IActionResult AssignDriver(string driverphone, string vehicletype)
        {
            int  orderId   = (int)TempData["OrderId"];
            Time addedTime = _timeRepository.AddTime(_newOrderStorage[orderId].OrderDateTime);

            _diversAndTimesRepository.AddDriverAndTime(addedTime.Id, driverphone);
            _clientsRepository.AddClient(_newOrderStorage[orderId].ClientName, _newOrderStorage[orderId].ClientPhoneNumber);
            int locationId = _locationRepository.GetLocationsId(_newOrderStorage[orderId].Location);

            _orderRepository.AddOrder(driverphone, _newOrderStorage[orderId].ClientPhoneNumber, locationId, _newOrderStorage[orderId].Comforts, addedTime.Id, _newOrderStorage[orderId].MinimalPrice, OrderStatuses.InProgress);

            _newOrderStorage.RemoveAt(orderId);

            _appDbContext.Database.ExecuteSqlRaw("assign_driver");

            return(ViewComponent("DriversList", new { selectedStatus = DefaultDriverStatus, selectedVehicleType = vehicletype }));
        }