public async Task <ServiceResult> Add([FromBody] AboutUsAddModel apiEntity) { var entity = AboutUsAddModel.Map(apiEntity); var result = await _contentGroupService.AddAsync(entity); if (result.TryCastModel(out ContentGroup contentGroup)) { result.ViewModel = AboutUsViewModel.Map(contentGroup); } return(result); }
public async Task <ServiceResult> Edit(Guid id, [FromBody] AboutUsEditModel apiEntity) { var entity = AboutUsEditModel.Map(apiEntity, id); var result = await _contentGroupService.UpdateAsync(entity); if (result.TryCastModel(out ContentGroup contentGroup)) { result.ViewModel = AboutUsViewModel.Map(contentGroup); } return(result); }
public async Task <AboutUsViewModel> GetOne(Guid id) { var entity = await _contentGroupService.FindByAsync(ContentGroupName.AboutUs, x => x.Id == id); return(AboutUsViewModel.Map(entity)); }