public ActionResult Edit(EditFactorDto vm)
        {
            if (ModelState.IsValid)
            {
                var factor = new Factor();
                factor.Id         = vm.Id;
                factor.Date       = DateTime.Now;
                factor.Price      = vm.Price;
                factor.CustomerId = vm.CustomerId;

                _factorRepository.EditFactor(factor);

                TempData["CurrentUser"] = vm.CustomerId;

                return(RedirectToAction("List"));
            }
            else
            {
                vm.Customer = _customerRepository.Customers
                              .Select(a => new System.Web.Mvc.SelectListItem()
                {
                    Text  = a.FirstName + " " + a.LastName,
                    Value = a.Id.ToString()
                }).ToList();

                return(View(vm));
            }
        }
        public async Task <IActionResult> EditFactor(string factorId, EditFactorDto editFactorDto)
        {
            var factorFromRepo = await _db.FactorRepository.GetByIdAsync(factorId);

            if (factorFromRepo != null)
            {
                factorFromRepo.RefBank = editFactorDto.RefBank;
                if (await _db.SaveAsync())
                {
                    return(NoContent());
                }
                else
                {
                    return(BadRequest("خطا در ویرایش فاکتور"));
                }
            }
            else
            {
                return(BadRequest("فاکتور با این شناسه یافت نشد"));
            }
        }