public async Task <IActionResult> EditPeopleRegister(int id, [FromBody] SavePersonProfileResource resource) { var customer = _mapper.Map <SavePersonProfileResource, PersonProfile>(resource); var result = await _customerService.UpdateAsync(id, customer); if (!result.Success) { return(BadRequest(result.Message)); } var customerResource = _mapper.Map <PersonProfile, PersonProfileResource>(result.Customer); return(Ok(customerResource)); }
public async Task <ActionResult> RegisterPeople([FromBody] SavePersonProfileResource resource) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var customer = _mapper.Map <SavePersonProfileResource, PersonProfile>(resource); var result = await _customerService.SaveAsync(customer); if (!result.Success) { return(BadRequest(result.Message)); } var customerResource = _mapper.Map <PersonProfile, PersonProfileResource>(result.Customer); return(Ok(customerResource)); }