public async Task <BookDto> CreateOrUpdate(CreateOrUpdateBookDto input) { Book result = null; if (!input.Id.HasValue) { input.Id = GuidGenerator.Create(); result = await _repository.InsertAsync(ObjectMapper.Map <CreateOrUpdateBookDto, Book>(input)); } else { var data = await _repository.GetAsync(input.Id.Value); result = await _repository.UpdateAsync(ObjectMapper.Map(input, data)); } return(ObjectMapper.Map <Book, BookDto>(result)); }
public Task <BookDto> CreateOrUpdate(CreateOrUpdateBookDto input) { return(_BookAppService.CreateOrUpdate(input)); }