public ActionResult VolunteerDetails(int id) { try { var result = _volunteerService.GetById(id); var result2 = _userService.GetById(id); DetailsViewModel details = new DetailsViewModel(); SignUpViewModel sg = new SignUpViewModel(); sg = details.SignUpViewModel(result.Data, result2.Data); if (result.HasError) { ViewBag.Message = result.Message; return(Content(result.Message)); } if (result2.HasError) { ViewBag.Message = result2.Message; return(Content(result2.Message)); } if (result.HasError) { ViewBag.Message = result.Message; return(Content(result.Message)); } ViewBag.Entry = HttpUtil.CurrentUser.UserType; return(View(sg)); } catch (Exception e) { return(Content(e.Message)); } }
public ActionResult Details(int?id) { /*if (Session["AdminEmail"] == null) * { * return RedirectToAction("Login", "Admin"); * }*/ if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Volunteer volunteer = volunteerService.GetById(id); return(View(volunteer)); }
public async Task <VolunteerModel> Get(int id) { return(await _volunteerService.GetById(id)); }
public ActionResult LogIn(User user) { try { var obj = _service.GetByEmail(user.Email); var volunteer = _volunteerService.GetById(obj.Data.UserId); if (obj.Data.UserType.Equals("Volunteer")) { if (volunteer.Data.IsApprove.Equals("false")) { return(Content("Your Volunteer Request is Pending !!! Please wait")); } if (volunteer.Data.IsVolunteerDone.Equals("Done")) { volunteer.Data.IsActive = "true"; } else { volunteer.Data.IsActive = "false"; } _volunteerService.Save(volunteer.Data); } var volunteerdoctor = _volunteerDoctorService.GetById(obj.Data.UserId); if (obj.Data.UserType.Equals("Doctor")) { if (volunteerdoctor.Data.IsDoctorDone.Equals("Done")) { volunteerdoctor.Data.IsActive = "true"; } else { volunteerdoctor.Data.IsActive = "false"; } _volunteerDoctorService.Save(volunteerdoctor.Data); } var result = _service.Login(user.Email, user.Password); if (result == false) { ViewBag.Message = "Invalid Email and Password"; return(Content("Invalid Email and Password")); } if (obj.HasError) { ViewBag.Message = "Invalid Email and Password"; return(Content(obj.Message)); } var jasonUserInfo = JsonConvert.SerializeObject(obj.Data); FormsAuthentication.SetAuthCookie(jasonUserInfo, false); if (obj.Data.UserType.Equals("Volunteer")) { return(RedirectToAction("VolunteerActivities", "Volunteer")); } else if (obj.Data.UserType.Equals("Doctor")) { return(RedirectToAction("VolunteerDoctorActivities", "VolunteerDoctor")); } return(RedirectToAction("GetAllRequest", "Request")); } catch (Exception e) { return(Content(e.Message)); } }
public VolunteerViewModel GetById(long id) { return(_mapper.Map <Volunteer, VolunteerViewModel>(_volunteerService.GetById(id))); }
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)); } }
public ActionResult RequestDetails(int id, int count = 0) { try { ListViewModel list = new ListViewModel(); var result = _requestService.GetById(id); if (result.HasError) { ViewBag.Message = result.Message; return(Content(result.Message)); } list.Request = result.Data; result.Data.Status = "Working"; _requestService.Save(result.Data); var result2 = _volunteerService.GetAll(); list.Volunteers = result2.Data.Where(q => q.IsActive.Equals("true") && q.Area.Equals(result.Data.OptionalLocation)).ToList(); foreach (var p in list.Volunteers) { list.Users.Add(_userService.GetById(p.UserId).Data); } if (result2.HasError) { ViewBag.Message = result2.Message; return(Content(result2.Message)); } list.Request = result.Data; ViewBag.count = count; var assigned = _assignedRequest.GetAll(id.ToString()); if (assigned.Data.Count != 0) { foreach (var p in assigned.Data) { if (p.VolunteerDoctorId != 0) { var doc = _volunteerDoctorService.GetById(p.VolunteerDoctorId).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 assigned.Data) { if (p.VolunteerId != 0) { var vol = _volunteerService.GetById(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); } } ViewBag.hasvolunteer = 1; } ViewBag.Entry = HttpUtil.CurrentUser.UserType; var notification = _notificationService.GetById(id); if (notification.Data.UserId == 0) { notification.Data.IsDeliver = "true"; } var result3 = _notificationService.Save(notification.Data); if (result3.HasError) { ViewBag.Message = result3.Message; return(Content(result3.Message)); } return(View(list)); } catch (Exception e) { return(Content(e.Message)); } }