public ActionResult Detail(string id) { var existingData = _kppbcbll.GetKppbcById(id); var model = new KppbcDetailViewModel { Kppbc = Mapper.Map <ZAIDM_EX_KPPBCDto>(existingData), CurrentMenu = PageInfo, MainMenu = _mainMenu }; model.MengetahuiHTML = !string.IsNullOrEmpty(model.Kppbc.MENGETAHUI_DETAIL) ? model.Kppbc.MENGETAHUI_DETAIL.Replace("<br />", Environment.NewLine) : ""; return(View("Detail", model)); }
public ActionResult Edit(string id) { if (CurrentUser.UserRole == Enums.UserRole.Viewer || CurrentUser.UserRole == Enums.UserRole.Controller) { return(RedirectToAction("Detail", new { id })); } var existingData = _kppbcbll.GetKppbcById(id); var model = new KppbcDetailViewModel { Kppbc = Mapper.Map <ZAIDM_EX_KPPBCDto>(existingData), CurrentMenu = PageInfo, MainMenu = _mainMenu }; model.MengetahuiHTML = !string.IsNullOrEmpty(model.Kppbc.MENGETAHUI_DETAIL) ? model.Kppbc.MENGETAHUI_DETAIL.Replace("<br />", Environment.NewLine) : ""; return(View("Edit", model)); }
public ActionResult Edit(KppbcDetailViewModel model) { try { // TODO: Add insert logic here var existingData = _kppbcbll.GetKppbcById(model.Kppbc.KPPBC_ID); existingData.MENGETAHUI_DETAIL = !string.IsNullOrEmpty(model.MengetahuiHTML) ? model.MengetahuiHTML.Replace(Environment.NewLine, "<br />") : ""; existingData.MODIFIED_BY = CurrentUser.USER_ID; existingData.MODIFIED_DATE = DateTime.Now; _kppbcbll.Save(existingData); AddMessageInfo(Constans.SubmitMessage.Updated, Enums.MessageInfoType.Success ); return(RedirectToAction("Index")); } catch (Exception ex) { AddMessageInfo(ex.Message, Enums.MessageInfoType.Error ); return(View(model)); } }