/*  public ActionResult AssignedRequest()
         * {
         *    try
         *    {
         *        var result = _volunteerService.GetAll();
         *        var result2 = _volunteerDoctorService.GetAll();
         *        var requestModel = new RequestViewModel();
         *        requestModel.Volunteers = result.Data.Where(q => q.IsActive.Equals("true")).ToList();
         *        requestModel.VolunteerDoctors = result2.Data.Where(q => q.IsActive.Equals("true")).ToList();
         *        if (result.HasError)
         *        {
         *            ViewBag.Message = result.Message;
         *            return Content(result.Message);
         *        }
         *        if (result2.HasError)
         *        {
         *            ViewBag.Message = result2.Message;
         *            return Content(result2.Message);
         *        }
         *
         *    }
         *    catch (Exception e)
         *    {
         *        return Content(e.Message);
         *    }
         *    return Content("Hello");
         * }
         */

        public ActionResult AssignedRequests(int requestId, int volunteerId, int empId)
        {
            try
            {
                AssignedRequest assign = new AssignedRequest();
                assign.RequestId   = requestId;
                assign.VolunteerId = volunteerId;
                assign.EmployeeId  = empId;
                var result2 = _volunteerService.GetById(volunteerId);
                result2.Data.IsActive        = "false";
                result2.Data.IsVolunteerDone = "Not Done";
                _volunteerService.Save(result2.Data);
                var result = _assignedRequest.Save(assign);
                ViewBag.count = 1;
                if (result.HasError)
                {
                    return(Content(result.Message));
                }
                Notification notification = new Notification();
                notification.RequestId = requestId;
                notification.UserId    = volunteerId;
                var result3 = _notificationService.Save(notification);
                if (result3.HasError)
                {
                    ViewBag.Message = result3.Message;
                    return(Content(result3.Message));
                }
            }
            catch (Exception e)
            {
                return(Content(e.Message));
            }
            return(RedirectToAction("RequestDetails", "Request", new { id = requestId, count = 1 }));
        }
 public ActionResult DeleteEmployee(int id)
 {
     try
     {
         var result  = _employeeService.Delete(id);
         var result2 = _userService.Delete(id);
         var assign  = _assignedRequest.GetEmployeeAll(id);
         foreach (var p in assign.Data)
         {
             var x = _assignedRequest.GetById(p.RequestId);
             x.Data.EmployeeId = 0;
             _assignedRequest.Save(x.Data);
         }
         return(RedirectToAction("GetAllEmployee"));
     }
     catch (Exception e)
     {
         return(Content(e.Message));
     }
 }