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()); } }
public ViewResult Create(int?id) { Leaves.Student.Models.Student student = _studentRepository.GetStudent(id ?? 0); return(View(student)); }