Example #1
0
 private static Expression <Func <Doctor, bool> > ApplyFiliter(DoctorSearch doctorSearch)
 {
     return
         (d => (!doctorSearch.Categories.Any() || doctorSearch.Categories.Contains(d.CategoryId)) &&
          (!doctorSearch.Countries.Any() || doctorSearch.Countries.Contains(d.Country)) &&
          (!doctorSearch.Cities.Any() || doctorSearch.Cities.Contains(d.City)) &&
          (string.IsNullOrEmpty(doctorSearch.Name) || d.Name.ToLower().Contains(doctorSearch.Name.ToLower())));
 }
Example #2
0
 public IActionResult Get(string textBoxSearch, DoctorSearch doctorSearch)
 {
     if (doctorSearch == DoctorSearch.All)
     {
         return(Ok(_doctorService.GetAll()));
     }
     else if (doctorSearch == DoctorSearch.ByExaminationRoom)
     {
         if (Int32.TryParse(textBoxSearch, out int id))
         {
             return(Ok(_doctorService.GetDoctorByExaminationRoom(id)));
         }
         else
         {
             return(Ok());
         }
     }
     else
     {
         return(Ok());
     }
 }
Example #3
0
        public async Task <IActionResult> Index(DoctorSearch doctorSearch)
        {
            var doctors = await _doctorRepository.GetDoctorsAsync(doctorSearch);

            return(View(new DoctorViewModel(doctors, doctorSearch)));
        }
Example #4
0
 public DoctorViewModel(IEnumerable <Doctor> doctors, DoctorSearch doctorSearch)
 {
     this.Doctors      = doctors;
     this.DoctorSearch = doctorSearch;
 }
Example #5
0
 public async Task <IEnumerable <Doctor> > GetDoctorsAsync(DoctorSearch doctorSearch)
 {
     return(await GetAll(ApplyFiliter(doctorSearch)).Include(d => d.Category).OrderByDescending(o => o.Id).ToListAsync());
 }