public ActionResult Details(int id) { IIntroductionService introducSrv = IoC.Resolve <IIntroductionService>(); var model = introducSrv.Getbykey(id); return(View(model)); }
public ActionResult AddIntruction(IntroductionType type = IntroductionType.LichSu) { IIntroductionService introducSrv = IoC.Resolve <IIntroductionService>(); Introduction model = introducSrv.Query.Where(p => p.Type == type).FirstOrDefault() ?? new Introduction(); model.Type = type; model.Active = true; return(View(model)); }
public ActionResult SaveIntruction(Introduction model) { IIntroductionService introducSrv = IoC.Resolve <IIntroductionService>(); try { model.CreateDate = DateTime.Now; model.CreateBy = HttpContext.User.Identity.Name; introducSrv.Save(model); introducSrv.CommitChanges(); logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "SaveIntruction - Save : " + model.Id, "Save SaveIntruction Success", LogType.Success, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); return(RedirectToAction("Details", new { id = model.Id })); } catch (Exception ex) { logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "SaveIntruction - Save", "Save SaveIntruction Error : " + ex.Message, LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); Messages.AddErrorMessage("Có lỗi xảy ra, vui lòng thực hiện lại"); return(View("AddIntruction", model)); } }
public IntroductionController(IIntroductionService IntroductionService) { this.IntroductionService = IntroductionService; }