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")); }
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")); }