public async Task <IActionResult> Details(Guid id) { var dentist = await _dentistService.Get(id); if (ValidOperation() is false) { return(NotFound()); } return(PartialView("_DetailsDentist", dentist)); }
public ActionResult <DentistViewModel> GetDentist(string id) { var dentist = _service.Get(id); if (dentist == null) { return(NotFound()); } return(DentistMapper.DTOtoDentistViewModel(dentist)); }
public async Task <IActionResult> GetExpertise(Guid dentistId) { var dentist = await _dentistService.Get(dentistId); if (ValidOperation() is false) { return(Json(new { success = false })); } return(Json(new { success = true, data = dentist.Expertise.GetDisplayValue() })); }
public async Task Create(SchedulingDataModel request) { var dentist = await _dentistService.Get(request.DentistId); if (dentist is null) { Notify("Dentista não encontrado"); return; } var patient = await _patientService.Get(request.Patient.Id); if (patient is null) { Notify("Paciente não encontrado"); return; } if (request.DateTime == DateTime.MinValue) { Notify("Data inválida"); return; } var scheduling = new Scheduling(request.DateTime, dentist.Id, request.Obs, patient.Id, request.Type, dentist.Expertise); if (scheduling.IsValid()) { await _schedulingRepository.AddAsync(scheduling); } else { Notify(scheduling.ValidationResult); return; } if (await CommitAsync() is false) { Notify("Erro ao salvar dados."); } }