Exemple #1
0
        public ActionResult Index(string massage)
        {
            var viewModel = new ListOfDoctorsViewModel
            {
                Doctors     = _context.Doctors.Include(d => d.DoctorType).Where(d => d.IsApproved),
                DoctorTypes = _context.DoctorTypes.ToList(),
                Massage     = massage
            };

            return(View(User.IsInRole(UserRoles.CanApproveAndDeleteRecord) ? "ListOfDoctors" : "ListOfDoctorsReadOnly", viewModel));
        }
Exemple #2
0
        public ActionResult Search(SearchDto search)
        {
            ListOfDoctorsViewModel viewModel;

            if (search.Area == null && search.Category == null)
            {
                viewModel = new ListOfDoctorsViewModel
                {
                    Doctors     = _context.Doctors.Include(d => d.DoctorType).Where(d => d.IsApproved),
                    DoctorTypes = _context.DoctorTypes.ToList()
                };
            }
            else if (search.Area == null)
            {
                viewModel = new ListOfDoctorsViewModel
                {
                    Doctors     = _context.Doctors.Include(d => d.DoctorType).Where(d => d.IsApproved && d.DoctorTypeId == search.Category),
                    DoctorTypes = _context.DoctorTypes.ToList()
                };
            }
            else if (search.Category == null)
            {
                viewModel = new ListOfDoctorsViewModel
                {
                    Doctors     = _context.Doctors.Include(d => d.DoctorType).Where(d => d.IsApproved && d.Area == search.Area),
                    DoctorTypes = _context.DoctorTypes.ToList()
                };
            }
            else
            {
                viewModel = new ListOfDoctorsViewModel
                {
                    Doctors     = _context.Doctors.Include(d => d.DoctorType).Where(d => d.IsApproved && (d.Area == search.Area && d.DoctorTypeId == search.Category)),
                    DoctorTypes = _context.DoctorTypes.ToList()
                };
            }

            return(View(User.IsInRole(UserRoles.CanApproveAndDeleteRecord) ? "ListOfDoctors" : "ListOfDoctorsReadOnly", viewModel));
        }