/// <summary> /// Save current page to audit /// </summary> /// <param name="model"></param> /// <returns></returns> public ResponseModel SavePageTemplateLog(PageTemplateLogManageModel model) { var pageTemplate = _pageTemplateRepository.GetById(model.PageTemplateId); if (pageTemplate != null) { /* * Map page template log model to log entity * Get last updated version of template log * If there are nothing change then do not do anything * Otherwise insert log */ Mapper.CreateMap <PageTemplateLogManageModel, PageTemplateLog>(); var log = Mapper.Map <PageTemplateLogManageModel, PageTemplateLog>(model); var pageTemplateLog = GetAll() .Where(a => a.PageTemplateId == pageTemplate.Id) .OrderByDescending(a => a.Id) .FirstOrDefault(); log.ChangeLog = pageTemplateLog != null ? ChangeLog(pageTemplateLog, model) : "** Create Page Template **"; if (string.IsNullOrEmpty(log.ChangeLog)) { return(new ResponseModel { Success = true }); } log.SessionId = HttpContext.Current.Session.SessionID; return(Insert(log)); } return(new ResponseModel { Success = false, Message = T("Page_Message_ObjectNotFound") }); }
public NewsCategory GetById(object id) { return(_newsCategoryRepository.GetById(id)); }
public PageTemplate GetById(object id) { return(_pageTemplateRepository.GetById(id)); }