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