예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
            }
        }