public ActionResult Edit(PriceListSection priceListSection) { try { var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(priceListSection.Title), StaticPaths.PriceListSectionImages); if (files.Count > 0) { priceListSection.Image = files[0].Title; } priceListSection.LastUpdate = DateTime.Now; ViewBag.Success = true; if (priceListSection.ID == -1) { PriceListSections.Insert(priceListSection); UserNotifications.Send(UserID, String.Format("جدید - برندهای لیست بنک داری '{0}'", priceListSection.Title), "/Admin/PriceListSections/Edit/" + priceListSection.ID, NotificationType.Success); priceListSection = new PriceListSection(); } else { PriceListSections.Update(priceListSection); } } catch (Exception ex) { SetErrors(ex); } return(ClearView(priceListSection)); }
public ActionResult Edit(int?id) { PriceListSection priceListSection; if (id.HasValue) { priceListSection = PriceListSections.GetByID(id.Value); } else { priceListSection = new PriceListSection(); } return(View(priceListSection)); }