// GET: AccountOffers/Edit/5 public ActionResult Edit(int id) { var service = CreateAccountOfferService(); var detail = service.GetAccountOfferById(id); var model = new AccountOfferEdit { OfferId = detail.OfferId, Title = detail.Title, Body = detail.Body, IsActive = detail.IsActive }; return(View(model)); }
public ActionResult Edit(int id, AccountOfferEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.OfferId != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = CreateAccountOfferService(); if (service.UpdateAccountOffer(model)) { TempData["SaveResult"] = "Your offer was modified."; return(RedirectToAction("Index")); } ModelState.AddModelError("", "Your offer could not be updated."); return(View(model)); }