public async Task Update(DentistDataModel request) { var dentist = await _dentistRepository.GetAsync(request.Id); if (dentist is null) { Notify("Dados do Dentista não encontrado."); return; } if (request.BirthDate == DateTime.MinValue) { Notify("Data inválida"); return; } dentist.Update(request.BirthDate, request.Cep, request.City, request.Complement, request.Cpf.Replace(".", "").Replace("-", ""), request.District, request.Email, request.Name, request.Number, request.State, request.Street, request.Cro, request.Expertise); if (dentist.IsValid()) { _dentistRepository.Update(dentist); } else { Notify(dentist.ValidationResult); return; } if (await CommitAsync() is false) { Notify("Erro ao salvar dados."); } }
public async Task EditDentist_Post(DentistForCreateVM editedDentist) { var dentist = _mapper.Map <Dentist>(editedDentist); await _dentistRepository.Update(dentist); }