public async Task UpdateAsync(UpdateProcessamentRequestModel requestModel) { var user = await userRepository.GetByCPFAsync(requestModel.UserCPF); switch (user != null) { case true: { var processament = await processamentRepository.GetByUserCPFAsync(requestModel.UserCPF); switch (processament != null) { case true: { var processamentEdited = mapper.Map <ProcessamentModel>(requestModel); processamentEdited.Id = processament.Id; processamentEdited.CreateDate = processament.CreateDate; await processamentRepository.UpdateAsync(processamentEdited); break; } case false: throw new Exception("The Processament doenst exists.");; } break; } case false: throw new Exception("The CPF doenst exists."); } }
public async Task <IActionResult> Put([FromBody] UpdateProcessamentRequestModel requestModel) { await processamentService.UpdateAsync(requestModel); return(Ok("Processament updated successfully.")); }