/// <summary> /// A function that displays the view used to edit an Assignment /// </summary> public ActionResult Edit(int id) { #region Security string ID = null; if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Home")); } if (!accountService.GetIdByUser(User.Identity.Name, ref ID)) { return(RedirectToAction("Index", "Home")); } if (id <= 0) { return(View()); } #endregion AssignmentViewModel viewModel = assignmentService.GetAssignmentsById(id); if (viewModel != null) { return(View(viewModel)); } return(RedirectToAction("TeacherOverview", new { id = id })); }