예제 #1
0
        public ActionResult CreateDenialType(CreateDenialTypeViewModel model)
        {
            var success = false;
            var message = mc_ExceptionMessage_Error;

            try
            {
                if (!ValidateDenialTypeId(model.DenialTypeId))
                {
                    ModelState.AddModelError("DenialTypeId", "The Denial Type Id must be unique.");
                }

                if (!ValidateDenialTypeCode(model.DenialTypeCodeId))
                {
                    ModelState.AddModelError("DenialTypeCodeId", "The Denial Type Code must be unique.");
                }

                if (ModelState.IsValid)
                {
                    _denialTypeService.CreateNewDenialType(Convert.ToInt32(model.DenialTypeId), model.DenialTypeCodeId, model.DenialTypeDescription);
                    success = true;
                    message = "Successfully added Denial Type.";
                }
            }
            catch (Exception ex)
            {
                _log.Error(FormatException(ex));
                Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
                return(Json(message, JsonRequestBehavior.AllowGet));
            }

            ViewBag.DialogResult = BuildDialogResult(success, message);
            return(PartialView("_CreateDenialType", model));
        }
예제 #2
0
 public ActionResult CreateDenialType()
 {
     try
     {
         var model = new CreateDenialTypeViewModel();
         return(PartialView("_CreateDenialType", model));
     }
     catch (Exception ex)
     {
         _log.Error(FormatException(ex));
         Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
         return(Json(mc_ExceptionMessage_Error, JsonRequestBehavior.AllowGet));
     }
 }