示例#1
0
        public ActionResult EditAwardType(int awardTypeId)
        {
            var awardType = DatabaseSession.Get <AwardType>(awardTypeId);
            var viewModel = new AwardTypeViewModel(awardType, this.Url);

            return(PartialView(viewModel));
        }
示例#2
0
        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()));
        }
示例#3
0
        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()));
        }