Exemple #1
0
 public ActionResult SaveCreateStudent([Bind(Include = "StuId,StuName")] Student stu)
 {
     if (ModelState.IsValid)
     {
         stuBL.AddStudent(stu);
         return(RedirectToAction("Index"));
     }
     return(View("Create", stu));
 }
Exemple #2
0
        public ActionResult Create(FormCollection formCollection)
        {
            if (ModelState.IsValid)
            {
                StudentDetails studentDetails = new StudentDetails();

                studentDetails.FirstName = formCollection["FirstName"];
                studentDetails.LastName  = formCollection["LastName"];
                studentDetails.studentEmails.Add(formCollection["Student Email"]);

                StudentBusinessLayer studentBusinessLayer = new StudentBusinessLayer();
                studentBusinessLayer.AddStudent(studentDetails);

                return(RedirectToAction("Index"));
            }
            return(View());
        }