// GET: Tasks public ActionResult Index(int?ActivityId, string Name) { if (ActivityId.Equals(null)) { return(Redirect("/Activity/Index")); } TaskRepo taskRepo = new TaskRepo(context); TempData["Activity"] = Name; TempData["ActivityId"] = ActivityId.ToString(); ViewBag.Users = context.Users.Select(r => new SelectListItem { Value = r.Id, Text = r.UserName }).ToList(); TasksViewModel taskviewmodel = new TasksViewModel() { tasks = taskRepo.GetTaskForActvity(ActivityId) }; return(View(taskviewmodel)); }