public CustomBO AddStudent(StudentOB student) { CustomBO objcustome = new CustomBO(); Student objstu = new Student() { Reg_no = student.RegisterNumber, FirstName = student.FirstName, LastName = student.LastName, Depart = student.Department, Semester = student.Semester }; SPE.Students.Add(objstu); int returnval = SPE.SaveChanges(); if (returnval > 0) { objcustome.CustomerMessage = "Data sucessfully added"; objcustome.CustomeNumber = returnval; } else { objcustome.CustomerMessage = "Data failed to add"; objcustome.CustomeNumber = returnval; } return(objcustome); }
public ActionResult Index(StudentOB student) { if (ModelState.IsValid) { StudentBL objstudent = new StudentBL(); CustomBO CBO = objstudent.AddStudent(student); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Index(UserBO objUserBO) { if (ModelState.IsValid) { UserBL objUserBl = new UserBL(); CustomBO objCustomBo = objUserBl.AddUser(objUserBO); } return(View(objUserBO)); }
public CustomBO AddUser(UserBO objUserBo) { CustomBO objCustomBo = new CustomBO(); Users objUser = new Users() { UserAddress = objUserBo.UserAddress, UserEmail = objUserBo.UserEmail, UserMobile = objUserBo.UserMobile, UserName = objUserBo.UserName, }; objUserDbEntities.Users.Add(objUser); int returnValue = objUserDbEntities.SaveChanges(); if (returnValue > 0) { objCustomBo.CustomMessage = "Data Succesfully Added"; objCustomBo.CustomMessageNumber = returnValue; } else { objCustomBo.CustomMessage = "There was some problem"; objCustomBo.CustomMessageNumber = returnValue; } return objCustomBo; }