public async Task <Response <int> > Handle(UpdatePersonCommand request, CancellationToken cancellationToken) { var person = _personRepositoryAsync.GetByIdAsync(request.Id); if (person == null) { throw new ApiException($"Not found this id: {request.Id}"); } else { var updatePerson = _mapper.Map <Person>(request); await _personRepositoryAsync.UpdateAsync(updatePerson); return(new Response <int>(person.Id)); } }
public async Task <ApiResponse <Person> > UpdateAsync(Person person) { var response = new ApiResponse <Person> { Errors = ValidatePerson(person, false) }; if (!response.Success) { return(response); } await personRepository.UpdateAsync(person); response.Data = person; return(response); }