Пример #1
0
        /// <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)
                                      : string.Format("** 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 = _localizedResourceServices.T("AdminModule:::PageTemplates:::Messages:::ObjectNotFounded:::Page Template is not founded.")
            });
        }
Пример #2
0
 public PageTemplate GetById(object id)
 {
     return(_pageTemplateRepository.GetById(id));
 }