Esempio n. 1
0
        public ActionResult UpdateUserOrder(string id)
        {
            OrderUser       orderUser       = UserService.FindOrderUser(id);
            CreateUserOrder createUserOrder = new CreateUserOrder();

            createUserOrder.StartAddressCity  = orderUser.StartAddressCity;
            createUserOrder.StartAddressRoad  = orderUser.StartAddressRoad;
            createUserOrder.StartAddressHouse = orderUser.StartAddressHouse;
            createUserOrder.EndAddressCity    = orderUser.EndAddressCity;
            createUserOrder.EndAddressRoad    = orderUser.EndAddressHouse;
            createUserOrder.EndAddressHouse   = orderUser.EndAddressRoad;
            createUserOrder.StartDate         = orderUser.StartDate;
            createUserOrder.DueDate           = orderUser.DueDate;
            createUserOrder.ProductName       = orderUser.ProductName;
            createUserOrder.Weight            = orderUser.Weight;
            createUserOrder.Id = orderUser.Id;
            return(View(createUserOrder));
        }
Esempio n. 2
0
        public ActionResult UpdateUserOrder(CreateUserOrder createUserOrder)
        {
            OrderUser orderUser = new OrderUser
            {
                EndAddressCity    = createUserOrder.EndAddressCity,
                EndAddressRoad    = createUserOrder.EndAddressRoad,
                EndAddressHouse   = createUserOrder.EndAddressHouse,
                ProductName       = createUserOrder.ProductName,
                StartAddressCity  = createUserOrder.StartAddressCity,
                StartAddressRoad  = createUserOrder.StartAddressRoad,
                StartAddressHouse = createUserOrder.StartAddressHouse,
                Weight            = createUserOrder.Weight,
                ApplicationUserId = User.Identity.GetUserId().ToString(),
                StartDate         = createUserOrder.StartDate,
                DueDate           = createUserOrder.DueDate,
                Status            = true,
                Id = createUserOrder.Id
            };

            UserService.UpdateOrderUser(orderUser);
            return(RedirectToAction("index", "Home"));
        }
Esempio n. 3
0
        public ActionResult CreateUserOrder(CreateUserOrder createUserOrder)
        {
            if (ModelState.IsValid)
            {
                string idDriver;
                if (TempData["ID"] != null)
                {
                    idDriver       = TempData["ID"].ToString();
                    TempData["ID"] = null;
                }
                else
                {
                    idDriver = null;
                }
                OrderUser orderUser = new OrderUser
                {
                    EndAddressCity    = createUserOrder.EndAddressCity,
                    EndAddressRoad    = createUserOrder.EndAddressRoad,
                    EndAddressHouse   = createUserOrder.EndAddressHouse,
                    ProductName       = createUserOrder.ProductName,
                    StartAddressCity  = createUserOrder.StartAddressCity,
                    StartAddressRoad  = createUserOrder.StartAddressRoad,
                    StartAddressHouse = createUserOrder.StartAddressHouse,
                    Weight            = createUserOrder.Weight,
                    ApplicationUserId = User.Identity.GetUserId().ToString(),
                    StartDate         = createUserOrder.StartDate,
                    DueDate           = createUserOrder.DueDate,
                    Status            = true
                };
                UserService.CreateUserOrder(orderUser, idDriver);

                string messege = "user Id:" + User.Identity.GetUserId() + "User Name: " + User.Identity.Name +
                                 "controller: AccountController,  Action CreateUserOrder Succses";
                logger.Info(messege);
                return(RedirectToAction("index", "Home"));
            }
            return(RedirectToAction("CreateUserOrder"));
        }