Example #1
0
 public IActionResult Insert(ICollection <CreateWorkingDayDTO> createWorkingDayDTOs)
 {
     try
     {
         string ClinicId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         IEnumerable <GetWorkingDayDTO> workingDaysDTOs = _workingDayAppService.GetWorkingDaysForDoctor(ClinicId);
         _workingDayAppService.DeleteList(workingDaysDTOs);
         List <CreateWorkingDayDTO> res = new List <CreateWorkingDayDTO>();
         foreach (var createWorkingDayDTO in createWorkingDayDTOs)
         {
             if (createWorkingDayDTO != null)
             {
                 createWorkingDayDTO.ClinicId = ClinicId;
                 res.Add(_workingDayAppService.Insert(createWorkingDayDTO));
             }
         }
         _generalAppService.CommitTransaction();
         return(Created("added", res));
     }
     catch (Exception ex)
     {
         _generalAppService.RollbackTransaction();
         return(BadRequest(ex.Message));
     }
 }
Example #2
0
        public IActionResult GetAllDoctorsInSpecailty(int SpecailtyID)
        {
            List <GetDoctorDto> doctors = this._doctorAppService.GetAllDoctorWhere(SpecailtyID);

            foreach (var doctor in doctors)
            {
                var _services    = _doctor_DoctorServiceAppService.GetDoctorServices(doctor.UserId);
                var _subSpecails = _doctorSubSpecialization.GetSubSpecialtyByDoctorId(doctor.UserId);
                var _clinic      = _clinicAppService.GetByStringId(doctor.UserId);

                double doctorAverageRate = _ratingAppService.getPublicRateForDoctor(doctor.UserId);


                doctor.services       = _services;
                doctor.subspecails    = _subSpecails;
                doctor.clinic         = _clinic;
                doctor.clinicAreaName = _areaAppService.GetById(_clinic.AreaId).Name;
                doctor.clinicCityName = _cityAppService.Get(_clinic.CityId).Name;
                IEnumerable <GetWorkingDayDTO> workingDaysDTOs = _workingDayAppService.GetWorkingDaysForDoctor(doctor.UserId);
                doctor.workingDays = workingDaysDTOs.ToList();
                doctor.averageRate = doctorAverageRate;
            }


            return(Ok(doctors));
        }