public ActionResult Update(int id) { ClassDataController controller = new ClassDataController(); Class SelectedClass = controller.FindClass(id); return(View(SelectedClass)); }
public ActionResult Create(string ClassCode, string ClassName, DateTime StartDate, DateTime FinishDate) { // Checking that the method is running Debug.WriteLine("The CREATE Method is running!"); // Checking that the inputs from the form has been received Debug.WriteLine("Class Code: " + ClassCode + ", Class Name: " + ClassName); Debug.WriteLine("From: " + StartDate + " to " + FinishDate); // Validating if (ClassCode == "" || ClassName == "") { return(RedirectToAction("New")); } else { // New Teacher Object Class NewClass = new Class(); NewClass.ClassCode = ClassCode; NewClass.ClassName = ClassName; NewClass.StartDate = StartDate; NewClass.FinishDate = FinishDate; // Instantiating ClassDataController controller = new ClassDataController(); controller.AddClass(NewClass); return(RedirectToAction("List")); } }
// GET: /Class/List /// <summary> /// Routes to a dynamically generated "Class List" Page. /// Gathers information about all the classes in the database. /// </summary> /// <param name="SearchKey"> A string that represents a class's name, or cousre code </param> /// <returns> A dynamic webpage which displays a list of classes </returns> /// <example> /// /Class/List /// </example> public ActionResult List(string SearchKey = null) { // Instantiating ClassDataController controller = new ClassDataController(); IEnumerable <Class> Classes = controller.ListClasses(SearchKey); return(View(Classes)); }
public ActionResult DeleteConfirmation(int id) { // Checking that the method is working Debug.WriteLine("The DELETE CONFIRMATION Method is running and is going to delete CLASS ID " + id); // Instantiating ClassDataController controller = new ClassDataController(); Class SelectedClass = controller.FindClass(id); return(View(SelectedClass)); }
// GET: /Class/Show/{id} /// <summary> /// Routes to a dynamically generated "Class Show" Page. /// Gathers information about a specific class from the database /// </summary> /// <param name="id"> An interger that represents Id of a class </param> /// <returns> A dynamic webpage which provides the current information of a class </returns> /// <example> /// /Class/Show/9 /// </example> public ActionResult Show(int id) { // Checking that the method is running Debug.WriteLine("The SHOW Method is running and the class_id is " + id); // Instantiating ClassDataController controller = new ClassDataController(); Class SelectedClass = controller.FindClass(id); return(View(SelectedClass)); }
public ActionResult Delete(int id) { // Check that the method is working Debug.WriteLine("The DLETE Method is running and has deleted CLASSID " + id); // Instantiating ClassDataController controller = new ClassDataController(); controller.DeleteClass(id); return(RedirectToAction("List")); }
public ActionResult Update(int id, string ClassCode, string ClassName, DateTime StartDate, DateTime FinishDate) { // New Class Object Class SelectedClass = new Class(); SelectedClass.ClassCode = ClassCode; SelectedClass.ClassName = ClassName; SelectedClass.StartDate = StartDate; SelectedClass.FinishDate = FinishDate; // Instantiating ClassDataController controller = new ClassDataController(); controller.UpdateClass(id, SelectedClass); return(RedirectToAction("Show/" + id)); }