Пример #1
0
 public void AddApplication(UserApplication application)
 {
     using (CollegeDBContext collegeDBContext = new CollegeDBContext())
     {
         collegeDBContext.UserApplications.Add(application);
         collegeDBContext.SaveChanges();
     }
 }
Пример #2
0
 public void UpdateApplication(UserApplication application)
 {
     using (CollegeDBContext collegeDBContext = new CollegeDBContext())
     {
         collegeDBContext.Entry(application).State = EntityState.Modified;
         collegeDBContext.SaveChanges();
     }
 }
 //
 //Summary:
 //  This method is used register user details to the database
 public void SignUp(User user)
 {
     using (CollegeDBContext collegeDBContext = new CollegeDBContext())
     {
         collegeDBContext.User.Add(user);
         collegeDBContext.SaveChanges();
     }
 }
Пример #4
0
 //
 //Summary:
 //  This method is to Add Department to database
 public void AddDepartmentByCollege(CollegeDepartment collegeDepartment)
 {
     using (CollegeDBContext collegeDBContext = new CollegeDBContext())
     {
         //SqlParameter DeptId = new SqlParameter("@DeptId", collegeDepartment.DeptId);
         //SqlParameter collegeCode = new SqlParameter("@CollegeCode", collegeDepartment.CollegeCode);
         //SqlParameter AvailableSeats = new SqlParameter("@AvailableSeats", collegeDepartment.AvailableSeats);
         //collegeDBContext.Database.ExecuteSqlCommand("@DeptId, @CollegeCode, @AvailableSeats", DeptId, collegeCode, AvailableSeats);
         collegeDBContext.CollegeDepartments.Add(collegeDepartment);
         collegeDBContext.SaveChanges();
     }
 }
Пример #5
0
 //
 //Summary:
 //  This method is to Update Department to database
 public void EditDepartment(CollegeDepartment collegeDepartment)
 {
     using (CollegeDBContext collegeDBContext = new CollegeDBContext())
     {
         //SqlParameter Id = new SqlParameter("@ID", collegeDepartment.ID);
         //SqlParameter DeptId = new SqlParameter("@DeptId", collegeDepartment.DeptId);
         //SqlParameter collegeCode = new SqlParameter("@CollegeCode", collegeDepartment.CollegeCode);
         //SqlParameter AvailableSeats = new SqlParameter("@AvailableSeats", collegeDepartment.AvailableSeats);
         //collegeDBContext.Database.ExecuteSqlCommand("CollegeDepartment_Update @ID, @DeptId, @CollegeCode, @AvailableSeats", Id, DeptId, collegeCode, AvailableSeats);
         collegeDBContext.Entry(collegeDepartment).State = EntityState.Modified;
         collegeDBContext.SaveChanges();
     }
 }