public HtmlContentDTO Save([FromBody] HtmlContentDTO model) { HtmlContent content = string.IsNullOrEmpty(model.Id) ? new HtmlContent() : _service.GetHtmlContent(model.Id); var mapper = new MapperConfiguration(cfg => { cfg.CreateMap <HtmlContentDTO, HtmlContent>(); }).CreateMapper(); mapper.Map(model, content); content.Id = string.IsNullOrEmpty(content.Id) ? Guid.NewGuid().ToString() : content.Id; _service.SaveHtmlContent(content); mapper = new MapperConfiguration(cfg => { cfg.CreateMap <HtmlContent, HtmlContentDTO>(); }).CreateMapper(); return(mapper.Map <HtmlContentDTO>(content)); }
public bool QuickSave([FromBody] HtmlContentDTO model) { _service.QuickSaveHtmlContent(model.Name, model.Content); return(true); }