public async Task <PageDto> Create(PageCreateUpdateDto input) { var model = input.MapTo <Page>(); model.CreatorUserId = HttpContext.Current.User.Identity.GetUserId(); model.Language = Eron.Core.ManagementSettings.ApplicationSettings.DefaultLanguage.ToString(); var pageEntity = UnitOfWork.PageRepository.Create(model); await UnitOfWork.SaveAsync(); return(pageEntity.MapTo <PageDto>()); }
public async Task <PageDto> Update(PageCreateUpdateDto input) { if (!input.IsUpdateEntry()) { throw new EntityNotFoundException(); } var model = input.MapTo <Page>(); UnitOfWork.PageRepository.Update(model); await UnitOfWork.SaveAsync(); return(model.MapTo <PageDto>()); }
public async Task <IHttpActionResult> Put(PageCreateUpdateDto input) { var result = await _service.Update(input); return(Ok(result)); }