public IActionResult Feed(EmployeesFeedViewModel model)
        {
            if (model.ProjectFilter != null)
            {
                model.LoadProjectDashboardData(model.Employee.Id, _unitOfWork, "All", IsPriorityButtonClicked(model.PriorityFilter));
            }
            else if (model.Assigned != null)
            {
                model.LoadDashboardData(model.Employee.Id, _unitOfWork);
            }
            else if (model.GeneralFilter != null)
            {
                model.LoadProjectDashboardData(model.Employee.Id, _unitOfWork, "General", IsPriorityButtonClicked(model.PriorityFilter));
            }
            else if (model.PriorityFilter != null)
            {
                GetFilteredList(model, IsPriorityButtonClicked(model.PriorityFilter));
            }
            else if (model.Search != null)
            {
                GetFilteredList(model, IsPriorityButtonClicked(model.PriorityFilter));
            }
            else
            {
                return(NotFound());
            }

            return(View(model));
        }
 public void GetFilteredList(EmployeesFeedViewModel model, bool priority)
 {
     if (model.ButtonClicked == "Project")
     {
         model.LoadProjectDashboardData(model.Employee.Id, _unitOfWork, "All", priority);
     }
     else if (model.ButtonClicked == "Assigned")
     {
         model.LoadDashboardData(model.Employee.Id, _unitOfWork);
     }
     else if (model.ButtonClicked == "General")
     {
         model.LoadProjectDashboardData(model.Employee.Id, _unitOfWork, "General", priority);
     }
 }
        public async Task <ActionResult> Feed(int employeeId, string buttonClicked, bool priority, string error)
        {
            EmployeesFeedViewModel model = new EmployeesFeedViewModel();
            var user = await GetCurrentUserAsync();

            var UserId = (int)user?.EmployeeId;

            if (employeeId == 0)
            {
                model.IsUserMe = true;
                model.LoadDashboardData(UserId, _unitOfWork);
            }
            else if (buttonClicked == null)
            {
                model.IsUserMe = CheckIfUserIsMe(UserId, employeeId);
                model.LoadDashboardData(employeeId, _unitOfWork);
            }
            else
            {
                model.IsUserMe      = CheckIfUserIsMe(UserId, employeeId);
                model.Employee      = _unitOfWork.Employees.GetById(employeeId);
                model.ButtonClicked = buttonClicked;
                GetFilteredList(model, priority);
            }

            if (error != null)
            {
                HandleOccuredError(model, error);
            }

            if (model == null)
            {
                return(NotFound());
            }

            return(View(model));
        }
 private void HandleOccuredError(EmployeesFeedViewModel model, string error)
 {
     model.Error        = true;
     model.Errormessage = error;
 }