// // GET: /MemberDonateType/Details/By ID public ActionResult Details(int id) { try { var memberDonateType = _db.MemberDonateTypes.Find(id); if (memberDonateType != null) { var memberDonateTypeViewModel = new MemberDonateTypeViewModel { Id = memberDonateType.Id, DonateTypeName = memberDonateType.DonateTypeName }; return(PartialView("_Details", memberDonateTypeViewModel)); } else { return(RedirectToAction("Index", "MemberDonateType")); } } catch (Exception ex) { ExceptionHelper.ExceptionMessageFormat(ex, true); return(RedirectToAction("Index", "MemberDonateType")); } }
public ActionResult Edit(MemberDonateTypeViewModel viewModel) { try { if (ModelState.IsValid) { var memberDonateType = new MemberDonateType { Id = viewModel.Id, DonateTypeName = viewModel.DonateTypeName }; _db.Entry(memberDonateType).State = EntityState.Modified; _db.SaveChanges(); return(Content(Boolean.TrueString)); } return(Content(ExceptionHelper.ModelStateErrorFormat(ModelState))); } catch (Exception ex) { ExceptionHelper.ExceptionMessageFormat(ex, true); return(Content("Sorry! Unable to edit this member donate type.")); } }