public ActionResult Create(CreateReturnRequestViewModel model, [Bind(Prefix = "ReturnRequestDetails")] List <ReturnRequestDetail> ReturnRequestDetails, [Bind(Prefix = "Storages")] List <Storage> Storages)
        {
            model.Products = _productService.GetAllProducts();
            var returnRequest = new ReturnRequest
            {
                Distributor          = model.idDistributor,
                DateCreate           = DateTime.Now,
                Status               = 0,
                Note                 = null,
                ModeOfReturn         = Convert.ToBoolean(model.modeOfReturn),
                Storage              = model.idStorage,
                Staff                = null,
                ReturnRequestDetails = ReturnRequestDetails
            };
            //};
            var result = _returnRequestService.CreateReturnRequest(returnRequest);

            if (result == "thanh cong")
            {
                TempData["success"] = "thanh cong";
                model = new CreateReturnRequestViewModel();
            }
            else
            {
                TempData["fail"] = result;
            }
            return(RedirectToAction("Create"));
        }
        public ActionResult Create()
        {
            isLogged();
            var user = Session["user"] as Account;

            Distributor dis = _distributorService.getDistributorByUser(user.UserName);

            if (dis != null)
            {
                var model = new CreateReturnRequestViewModel()
                {
                    idReturnRequest      = _returnRequestService.GenerateReturnRequestId(),
                    idDistributor        = dis.idDistributor,
                    Storages             = dis.Storages.ToList(),
                    ReturnRequestDetails = new List <ReturnRequestDetail>()
                };
                model.Products = _productService.GetAllProducts();
                return(View(model));
            }
            else
            {
                return(Redirect("/"));
            }
        }