Ejemplo n.º 1
0
        public async Task <IActionResult> Details(Guid id)
        {
            var dentist = await _dentistService.Get(id);

            if (ValidOperation() is false)
            {
                return(NotFound());
            }

            return(PartialView("_DetailsDentist", dentist));
        }
Ejemplo n.º 2
0
        public ActionResult <DentistViewModel> GetDentist(string id)
        {
            var dentist = _service.Get(id);

            if (dentist == null)
            {
                return(NotFound());
            }

            return(DentistMapper.DTOtoDentistViewModel(dentist));
        }
Ejemplo n.º 3
0
        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() }));
        }
Ejemplo n.º 4
0
        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.");
            }
        }