public ActionResult Add(MemberDonateWayViewModel viewModel) { try { if (ModelState.IsValid) { var memberDonateWay = new MemberDonateWay { Id = viewModel.Id, DonateWayName = viewModel.DonateWayName }; _db.MemberDonateWays.Add(memberDonateWay); _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 way."); } }
// // GET: /MemberDonateWay/Delete/By ID public ActionResult Delete(int id) { try { var memberDonateWay = _db.MemberDonateWays.Find(id); if (memberDonateWay != null) { var memberDonateWayViewModel = new MemberDonateWayViewModel { Id = memberDonateWay.Id, DonateWayName = memberDonateWay.DonateWayName }; return PartialView("_Delete", memberDonateWayViewModel); } else { return RedirectToAction("Index", "MemberDonateWay"); } } catch (Exception ex) { ExceptionHelper.ExceptionMessageFormat(ex, true); return RedirectToAction("Index", "MemberDonateWay"); } }