public ActionResult EditAwardType(int awardTypeId) { var awardType = DatabaseSession.Get <AwardType>(awardTypeId); var viewModel = new AwardTypeViewModel(awardType, this.Url); return(PartialView(viewModel)); }
public ActionResult POSTAddEditAwardType(AwardTypeViewModel postModel) { if (string.IsNullOrWhiteSpace(postModel.Name)) { return(new HttpBadRequestResult("Name Must Not Be Null")); } var awardType = new AwardType(); awardType.Name = postModel.Name; DatabaseSession.Save(awardType); if (Request.IsAjaxRequest()) { return(Json("OK")); } return(this.RedirectToAction(c => c.Admin())); }
public ActionResult POSTEditEditAwardType(int awardTypeId, AwardTypeViewModel postModel) { var awardType = DatabaseSession.Get <AwardType>(awardTypeId); if (awardType == null) { return(new HttpNotFoundResult()); } if (string.IsNullOrWhiteSpace(postModel.Name)) { return(new HttpBadRequestResult("Name Must Not Be Null")); } awardType.Name = postModel.Name; if (Request.IsAjaxRequest()) { return(Json("OK")); } return(this.RedirectToAction(c => c.Admin())); }