public ActionResult RequestDetailsDoctor(int id, int count = 0)
        {
            try
            {
                var result = _requestService.GetById(id);
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content(result.Message));
                }

                var           result3 = _volunteerDoctorService.GetAll();
                ListViewModel list    = new ListViewModel();
                list.VolunteerDoctors = result3.Data.Where(q => q.IsActive.Equals("true")).ToList();
                foreach (var p in list.VolunteerDoctors)
                {
                    var user = _userService.GetById(p.UserId).Data;
                    UserDoctorViewModel uv = new UserDoctorViewModel();
                    uv.UserId        = p.UserId;
                    uv.Email         = user.Email;
                    uv.Name          = user.Name;
                    uv.Phone         = user.Phone;
                    uv.SpecialDomain = p.SpecialDomain;
                    list.UserDoctorViewModel.Add(uv);
                }
                if (result3.HasError)
                {
                    ViewBag.Message = result3.Message;
                    return(Content(result3.Message));
                }

                list.Request  = result.Data;
                ViewBag.count = count;
                ViewBag.Entry = HttpUtil.CurrentUser.UserType;

                return(View(list));
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }
        }
Beispiel #2
0
        // GET
        public ActionResult GetAllVolunteerDoctor()
        {
            try
            {
                var           result = _volunteerDoctorService.GetAll();
                ListViewModel list   = new ListViewModel();
                list.VolunteerDoctors = result.Data;
                foreach (var p in list.VolunteerDoctors)
                {
                    var user = _userService.GetById(p.UserId).Data;
                    UserDoctorViewModel uv = new UserDoctorViewModel();
                    uv.UserId          = p.UserId;
                    uv.Email           = user.Email;
                    uv.Name            = user.Name;
                    uv.Phone           = user.Phone;
                    uv.SpecialDomain   = p.SpecialDomain;
                    uv.IsActive        = p.IsActive;
                    uv.Area            = p.Area;
                    uv.CurrentLocation = p.CurrentLocation;

                    list.UserDoctorViewModel.Add(uv);
                }
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content(result.Message));
                }
                ViewBag.Entry = HttpUtil.CurrentUser.UserType;

                return(View(list));
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }
        }
Beispiel #3
0
        public ActionResult WorkShopDetails(int id)
        {
            try
            {
                var           result = _workshopService.GetById(id);
                ListViewModel list   = new ListViewModel();
                list.WorkShop = result.Data;
                var result2   = _volunteerService.GetAll();
                var volunteer = result2.Data.ToList();
                var result3   = _volunteerDoctorService.GetAll();
                var doctor    = result3.Data.ToList();
                var assign    = _assignworkShopService.GetAllByWorkShopId(id);
                foreach (var p in assign.Data)
                {
                    var obj = _userService.GetById(p.UserId);
                    if (obj.Data.UserType.Equals("Volunteer"))
                    {
                        Volunteer vol = _volunteerService.GetById(obj.Data.UserId).Data;
                        volunteer.Remove(vol);
                    }

                    else if (obj.Data.UserType.Equals("Doctor"))
                    {
                        VolunteerDoctor vol = _volunteerDoctorService.GetById(obj.Data.UserId).Data;
                        doctor.Remove(vol);
                    }
                }


                foreach (var p in doctor)
                {
                    var doc  = _volunteerDoctorService.GetVolunteerDoctorById(p.DoctorId).Data;
                    var user = _userService.GetById(doc.UserId).Data;
                    UserDoctorViewModel uv = new UserDoctorViewModel();
                    uv.UserId          = user.UserId;
                    uv.Email           = user.Email;
                    uv.Name            = user.Name;
                    uv.Phone           = user.Phone;
                    uv.SpecialDomain   = doc.SpecialDomain;
                    uv.CurrentLocation = doc.CurrentLocation;
                    list.UserDoctorViewModel.Add(uv);
                }
                foreach (var p in volunteer)
                {
                    var vol  = _volunteerService.GetVolunteerById(p.VolunteerId).Data;
                    var user = _userService.GetById(vol.UserId).Data;
                    UserVolunteerViewModel uv = new UserVolunteerViewModel();
                    uv.UserId          = user.UserId;
                    uv.Email           = user.Email;
                    uv.Name            = user.Name;
                    uv.Phone           = user.Phone;
                    uv.JobDetails      = vol.JobDetails;
                    uv.CurrentLocation = vol.CurrentLocation;
                    list.UserVolunteerViewModels.Add(uv);
                }
                if (result.HasError)
                {
                    ViewBag.Message = result.Message;
                    return(Content(result.Message));
                }
                if (result2.HasError)
                {
                    ViewBag.Message = result2.Message;
                    return(Content(result2.Message));
                }
                if (result3.HasError)
                {
                    ViewBag.Message = result3.Message;
                    return(Content(result3.Message));
                }
                return(View(list));
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }
        }