示例#1
0
 public ActionResult Add(AddViewModel addmodel)
 {
     if (string.IsNullOrEmpty(addmodel.StudentRollno) || string.IsNullOrEmpty(addmodel.StudentName) ||
         string.IsNullOrEmpty(addmodel.StudentDOB) || string.IsNullOrEmpty(addmodel.StudentCGPA) ||
         string.IsNullOrEmpty(addmodel.StudentLocation))
     {
         addmodel.Error = "Plz fill all the fields!";
         return(View(addmodel));
     }
     _service.AddNewStudent(_service.ConvertVMToStudent(addmodel.StudentRollno, addmodel.StudentName,
                                                        addmodel.StudentDOB, addmodel.StudentCGPA, addmodel.StudentLocation));
     return(RedirectToAction("Index"));
 }