コード例 #1
0
ファイル: StudentDAL.cs プロジェクト: safame108/Example
        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);
        }
コード例 #2
0
 public ActionResult Index(StudentOB student)
 {
     if (ModelState.IsValid)
     {
         StudentBL objstudent = new StudentBL();
         CustomBO  CBO        = objstudent.AddStudent(student);
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
コード例 #3
0
        public ActionResult Index(UserBO objUserBO)
        {
            if (ModelState.IsValid)
            {
                UserBL   objUserBl   = new UserBL();
                CustomBO objCustomBo = objUserBl.AddUser(objUserBO);
            }

            return(View(objUserBO));
        }
コード例 #4
0
ファイル: UserDAL.cs プロジェクト: Gerixmus/Application-Dev
 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;
 }