public ActionResult EditRespGroupDetail(CreateEditRespGroupDetailViewModel model) { var jsonViewModel = new AjaxViewModel(); try { string json = JsonConvert.SerializeObject(model); var endpoint = String.Format("{0}/ValidateIsAxists", url); var isAxists = Utilities.RestAPIHelper <AjaxViewModel> .Submit(json, Method.POST, endpoint, Request); if (!isAxists.IsSuccess) { jsonViewModel.SetValues(isAxists.IsSuccess, null, isAxists.Message); } else { endpoint = url + "/EditRespGroupDetail"; model = Utilities.RestAPIHelper <CreateEditRespGroupDetailViewModel> .Submit(json, Method.PUT, endpoint, Request); jsonViewModel.SetValues(true, null, "Saved"); } } catch (Exception ex) { jsonViewModel.SetValues(false, null, String.Format("Failed\\nMessage: {0}", ex.GetBaseException().Message)); } return(Json(jsonViewModel)); }
public IActionResult ValidateIsAxists([FromBody] CreateEditRespGroupDetailViewModel model) { model.ID = (model.ID == null || model.ID == "" ? "0" : EncryptionHelper.DecryptUrlParam(model.ID)); var isValid = _resGroupDetailProvider.validateIsAxist(model); return(Ok(isValid)); }
public ActionResult CreateRespGroupDetail(string headerID) { var model = new CreateEditRespGroupDetailViewModel(); model.ResponsibilityGroupID = Convert.ToInt32(headerID); return(PartialView("CreateEditRespGroupDetail", model)); }
public IActionResult EditRespGroupDetail([FromBody] CreateEditRespGroupDetailViewModel model) { if (model == null) { return(BadRequest(" Responsibility Group Detail is null.")); } if (!ModelState.IsValid) { return(BadRequest()); } int DecryptID = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(model.ID)); var resGroupDetail = _resGroupDetailProvider.Get(DecryptID); model.ID = DecryptID.ToString(); var gradeMapper = _mapper.Map(model, resGroupDetail); _resGroupDetailProvider.Edit(gradeMapper); return(Ok()); }
public IActionResult AddGradeDetail([FromBody] CreateEditRespGroupDetailViewModel RespGroupDetail) { var model = new RespGroupDetail(); if (RespGroupDetail is null) { return(BadRequest("Responsibility Group Detail is null.")); } if (!ModelState.IsValid) { return(BadRequest()); } //grade.GroupGradeID = EncryptionHelper.DecryptUrlParam(grade.GroupGradeID); //int headerID = Int32.Parse(grade.GroupGradeID); var gradeMapper = _mapper.Map(RespGroupDetail, model); _resGroupDetailProvider.Add(gradeMapper); return(Ok()); }
public ActionResult EditRespGroupDetail(string id) { var jsonViewModel = new AjaxViewModel(); CreateEditRespGroupDetailViewModel model = new CreateEditRespGroupDetailViewModel(); try { int decryptID = Convert.ToInt32(EncryptionHelper.DecryptUrlParam(id)); var endpoint = url + "/GetRespGroupDetail/" + decryptID; model = Utilities.RestAPIHelper <CreateEditRespGroupDetailViewModel> .Submit("", Method.GET, endpoint, Request); } catch (Exception ex) { jsonViewModel.SetValues(false, null, String.Format("Failed\\nMessage: {0}", ex.GetBaseException().Message)); } return(PartialView("CreateEditRespGroupDetail", model)); }
public AjaxViewModel validateIsAxist(CreateEditRespGroupDetailViewModel model) { AjaxViewModel viewModel = new AjaxViewModel(); var id = Convert.ToInt32(model.ID); var exist = AllRespGroupDetail.Any(lv => lv.ResponsibilityGroupId == model.ResponsibilityGroupID && (lv.Id != id) && (lv.ResponsibilityId == model.ResponsibilityID) && !lv.DelDate.HasValue); if (exist) { viewModel.IsSuccess = false; viewModel.Message = " Responsibility already exists "; } else { viewModel.IsSuccess = true; viewModel.Message = "Success"; } return(viewModel); }