示例#1
0
        public ActionResult Create(StudentVM studentVm)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _istudent.CreateNewStudent(studentVm);
                    TempData["Message"] = "Student was successfully registered";
                    return(RedirectToAction(nameof(Create)));
                }

                return(RedirectToAction(nameof(Create)));
            }
            catch (Exception e)
            {
                TempData["MessageError"] = e.Message.ToString();
                return(RedirectToAction(nameof(Create)));
            }
        }
 public IActionResult CreateStudents(Student student)
 {
     _istudent.CreateNewStudent(student);
     return(Ok("Your data is saved successfully"));
 }