예제 #1
0
 public RedirectToRouteResult CreateStudent(string name, string department, string redirectSuccess, string redirectFailure)
 {
     if (repository.AddStudent(name, int.Parse(department)))
     {
         TempData["message"] = new MessageModel {
             Text = "Succesfully added student!", Type = "success"
         };
         return(RedirectToAction(redirectSuccess));
     }
     else
     {
         TempData["message"] = new MessageModel {
             Text = "Could not add the student.", Type = "danger"
         };
         return(RedirectToAction(redirectFailure));
     }
 }