public ActionResult Create(int ReturnRequestId)
        {
            _logger.Info("Start Create(GET) - ReturnController");
            isAdminLogged();
            var request = _returnService.GetReturnRequest(ReturnRequestId);
            var model   = new CreateReturnViewModel();

            if (request != null)
            {
                model = new CreateReturnViewModel()
                {
                    Storage       = request.Storage1 ?? new Storage(),
                    ReturnDetails = request.ReturnRequestDetails.Select(x => new ReturnDetail()
                    {
                        idProduct = x.IdProduct,
                        Quantity  = x.Quantity,
                        Product   = x.Product
                    }).ToList(),
                    Products        = _productService.GetAllProducts(),
                    DistributorId   = request.Distributor.HasValue ? request.Distributor.Value : 0,
                    DistributorName = request.Distributor1.name,
                    ReturnId        = _returnService.GenerateReturnId()
                };
                _logger.Info("Success: Complete Create(GET) - ReturnController");
            }
            else
            {
                _logger.Error("Error: Create(GET) - ReturnController | Can not find any return request with given id!");
            }
            return(View(model));
        }
        public ActionResult Create(CreateReturnViewModel model)
        {
            _logger.Info("Start Create(POST) - ReturnController");
            isAdminLogged();
            var currentUser = Session["admin"] as Account;
            var returnCard  = new ReturnBase
            {
                idStorage       = model.idStorage,
                Total           = model.Total,
                DateCreate      = DateTime.Now,
                ModeOfReturn    = Convert.ToBoolean(model.ReturnForm),
                idDistributor   = model.DistributorId,
                idStaff         = currentUser.idUser,
                idReturnRequest = model.ReturnRequestId,
                ReturnDetails   = model.ReturnDetails
            };
            var result = _returnService.CreateReturnCard(returnCard);

            if (result == "thanh cong")
            {
                TempData["success"] = "thanh cong";
            }
            else
            {
                TempData["fail"] = result;
            }
            model.Products = _productService.GetAllProducts();
            _logger.Info("Success: Complete Create(POST) - ReturnController");
            if (returnCard.ModeOfReturn == true)
            {
                return(RedirectToAction("Create", "Debt", new { idDistributor = returnCard.idDistributor }));
            }
            else
            {
                return(RedirectToAction("Create", new { ReturnRequestId = model.ReturnRequestId }));
            }
        }