Beispiel #1
0
 public ActionResult EditSale(EditSaleModel sale)
 {
     if (ModelState.IsValid)
     {
         using (IPL db = new PL())
         {
             int?managerId = 0;
             if (sale.ManagerName != null && db.GetManagerId(sale.ManagerName) != null)
             {
                 managerId = db.GetManagerId(sale.ManagerName);
             }
             if (db.EditSale(sale.Id, new SaleViewModel(DateTime.Now, sale.Client, sale.Product, sale.Price, (int)managerId)))
             {
                 return(RedirectToAction("ShowAllSales", "Admin"));
             }
             else
             {
                 ModelState.AddModelError("", "Неудалось изменить аккаунт");
             }
         }
     }
     return(View());
 }