Ejemplo n.º 1
0
 public ActionResult Edit(EditViewModel evm)
 {
     if (string.IsNullOrEmpty(evm.RollNumber) ||
         string.IsNullOrEmpty(evm.Name) ||
         string.IsNullOrEmpty(evm.CGPI) ||
         string.IsNullOrEmpty(evm.Location) ||
         string.IsNullOrEmpty(evm.DateOfBirth))
     {
         return(View(evm));
     }
     studentService.EditStudent(evm);
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 2
0
        public ActionResult Edit(EditViewModel vm)
        {
            if (string.IsNullOrEmpty(vm.StudentName) ||
                string.IsNullOrEmpty(vm.StudentDOB) || string.IsNullOrEmpty(vm.StudentCGPA) ||
                string.IsNullOrEmpty(vm.StudentLocation))
            {
                vm.Error = "Plz fill all the fields!";
                return(View(vm));
            }

            _service.EditStudent(_service.ConvertVMToStudent(vm.StudentRollno, vm.StudentName, vm.StudentDOB,
                                                             vm.StudentCGPA, vm.StudentLocation));

            return(RedirectToAction("Index"));
        }