public ActionResult Edit(PriceListProduct priceListProduct) { try { priceListProduct.LastUpdate = DateTime.Now; ViewBag.Success = true; if (priceListProduct.ID == -1) { PriceListProducts.Insert(priceListProduct); UserNotifications.Send(UserID, String.Format("جدید - محصولات لیست بنک داری '{0}'", priceListProduct.Title), "/Admin/PriceListProducts/Edit/" + priceListProduct.ID, NotificationType.Success); priceListProduct = new PriceListProduct(); } else { PriceListProducts.Update(priceListProduct); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(priceListProduct)); }
public ActionResult Edit(int?id) { PriceListProduct priceListProduct; if (id.HasValue) { priceListProduct = PriceListProducts.GetByID(id.Value); } else { priceListProduct = new PriceListProduct(); } return(View(priceListProduct)); }