Example #1
0
 public IActionResult Create(Leaves.Student.Models.Student student)
 {
     Leaves.Student.Models.Student newStudent = new Models.Student();
     if (student.Id == 0)
     {
         newStudent = _studentRepository.Add(student);
     }
     else
     {
         newStudent = _studentRepository.Update(student);
     }
     if (ModelState.IsValid)
     {
         return(RedirectToActionPermanent("Details", new { id = newStudent.Id }));
     }
     else
     {
         return(View());
     }
 }
Example #2
0
 public ViewResult Create(int?id)
 {
     Leaves.Student.Models.Student student = _studentRepository.GetStudent(id ?? 0);
     return(View(student));
 }