Exemple #1
0
 private TireStorage TransformAnEntity(TireStorageBll entity) =>
 Mapper.Map <TireStorageBll, TireStorage>(entity);
Exemple #2
0
 public async Task Insert(TireStorageBll element)
 {
     _unitOfWork.tireStorageUnitOfWork.Insert(TransformAnEntity(element));
     await _unitOfWork.Save();
 }
Exemple #3
0
 public async Task Update(TireStorageBll elementToUpdate)
 {
     _unitOfWork.tireStorageUnitOfWork.Update(TransformAnEntity(elementToUpdate));
     await _unitOfWork.Save();
 }
Exemple #4
0
        public async Task <ActionResult> ReviewTireStorageOrder(double?sum, int?idPaymentState, int?idStatusOrder, int?StockNumber)
        {
            if (StockNumber != null)
            {
                if (TempData.ContainsKey("TireStorageOrder") && TempData.ContainsKey("ReviwOrderMode"))
                {
                    var pageCreateResult  = TempData["TireStorageOrder"] as OrderTireStorageModelView;
                    var reviwOrderModules = TempData["ReviwOrderMode"] as ReviwOrderModelView;

                    OrderTireStorageModelBll orderTireStorage = Mapper.Map <OrderTireStorageModelView, OrderTireStorageModelBll>(pageCreateResult);
                    ReviwOrderModelBll       orderModelBll    = Mapper.Map <ReviwOrderModelView, ReviwOrderModelBll>(reviwOrderModules);

                    int idOrder = await _createOrder.SaveOrderTireFitting(reviwOrderModules.priceOfTire, reviwOrderModules.priceOfTire, idPaymentState.Value, idStatusOrder.Value, orderTireStorage.ClientId.Value, 5);

                    int idStorageFee = await _order.CreateStorageFee(orderTireStorage.storageTime.Value, sum);

                    if (reviwOrderModules.priceSilicone != 0 || reviwOrderModules.priceWheelWash != 0)
                    {
                        idOrderServices = await _createOrder.SaveOrderTireFitting(sum.Value, sum.Value, idPaymentState.Value, 1, orderTireStorage.ClientId.Value, 2);

                        if (reviwOrderModules.priceSilicone != 0)
                        {
                            var AdditionalTireStorageServicesEntity = new AdditionalTireStorageServicesView
                            {
                                clientsOfCarWashId     = orderTireStorage.ClientId.Value,
                                orderServicesCarWashId = idOrderServices.Value,
                                tireStorageServicesd   = orderModelBll.IdpriceSilicone,
                                Price = orderModelBll.priceSilicone
                            };

                            await _additionalTireStorageServices.Insert(TransformAnEntity(AdditionalTireStorageServicesEntity));
                        }

                        if (reviwOrderModules.priceWheelWash != 0)
                        {
                            var AdditionalTireStorageServicesEntity = new AdditionalTireStorageServicesView
                            {
                                clientsOfCarWashId     = orderTireStorage.ClientId.Value,
                                orderServicesCarWashId = idOrderServices.Value,
                                tireStorageServicesd   = orderModelBll.IdWheelWash,
                                Price = orderModelBll.priceWheelWash
                            };

                            await _additionalTireStorageServices.Insert(TransformAnEntity(AdditionalTireStorageServicesEntity));
                        }
                    }

                    var tireStorage = new TireStorageBll
                    {
                        serviceCostTirePackages = orderModelBll.priceNumberOfPackets,
                        dateOfAdoption          = orderTireStorage.dateOfAdoption,
                        quantity               = orderTireStorage.quantity,
                        radius                 = orderTireStorage.radius,
                        firm                   = orderTireStorage.firm,
                        discAvailability       = orderTireStorage.discAvailability,
                        storageFeeId           = idStorageFee,
                        tireStorageBags        = orderTireStorage.tireStorageBags,
                        wheelWash              = orderTireStorage.wheelWash,
                        IdOrderServicesCarWash = idOrder,
                        silicone               = orderTireStorage.silicone,
                        RelatedOrders          = idOrderServices,
                        stockNumber            = StockNumber
                    };

                    await _tireStorage.Insert(tireStorage);

                    await _wage.AdminWageTireStorage(idOrder, pageCreateResult.quantity.Value);
                }

                return(RedirectToAction("OrderTireStorage", "Order", new RouteValueDictionary(new
                {
                    typeOfOrder = 5,
                    statusOrder = 5
                })));
            }
            else
            {
                if (TempData.ContainsKey("Client"))
                {
                    TempData.Keep("Client");
                }

                if (TempData.ContainsKey("TireStorageOrder"))
                {
                    TempData.Keep("TireStorageOrder");
                }

                TempData.Keep("ReviwOrderMode");

                return(RedirectToAction("ReviewTireStorageOrder"));
            }
        }