Example #1
0
 /// <summary>
 /// Method that saves userhunt data in the 'userhunts' table.
 /// </summary>
 /// <param name="userHunt"></param>
 public void SaveUserHunt(userhunt userHunt)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.userhunts.AddObject(userHunt);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(userHunt, System.Data.EntityState.Added);
     }
 }
Example #2
0
 /// <summary>
 /// Method that saves company data into the 'companydetails' table.
 /// </summary>
 /// <param name="companyDetails"></param>
 public void saveCompany(companydetail companyDetails)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.companydetails.AddObject(companyDetails);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(companyDetails, System.Data.EntityState.Added);
     }
 }
Example #3
0
 /// <summary>
 /// Method that saves new usersecurityquestion data into the 'usersecurityquestions' table.
 /// </summary>
 /// <param name="userSecurityQuestion"></param>
 public void SaveUserSecurityQuestion(usersecurityquestion userSecurityQuestion)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.usersecurityquestions.AddObject(userSecurityQuestion);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(userSecurityQuestion, System.Data.EntityState.Added);
     }
 }
Example #4
0
 /// <summary>
 /// Method that saves new UserRole data into the 'userroles' table.
 /// </summary>
 /// <param name="newUserRole"></param>
 public void SaveUserRole(userrole newUserRole)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.userroles.AddObject(newUserRole);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(newUserRole, System.Data.EntityState.Added);
     }
 }
Example #5
0
 /// <summary>
 /// Method that saves new huntQuestion data into the 'huntquestions' table.
 /// </summary>
 /// <param name="huntQuestion"></param>
 public void SaveNewHuntQuestion(huntquestion huntQuestion)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.huntquestions.AddObject(huntQuestion);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(huntQuestion, System.Data.EntityState.Added);
     }
 }
 public void UpdateQuestion(question updatedQuestion)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.questions.AddObject(updatedQuestion);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(updatedQuestion, System.Data.EntityState.Modified);
     }
 }
Example #7
0
 /// <summary>
 /// Method that saves new hunt data into the 'hunts' table.
 /// </summary>
 /// <param name="newHunt"></param>
 /// <returns></returns>
 public long SaveNewHunt(hunt newHunt)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.hunts.AddObject(newHunt);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(newHunt, System.Data.EntityState.Added);
         return(newHunt.HuntId);
     }
 }
Example #8
0
 /// <summary>
 /// Method that updates the company password associated with a given user.
 /// </summary>
 /// <param name="currentUser"></param>
 /// <param name="newPassword"></param>
 public void updateCompanyPassword(user currentUser, String newPassword)
 {
     using (var context = new TreasureHuntEntities())
     {
         var companyToChange = context.companydetails.Where(c => c.UserId == currentUser.UserId).Single();
         companyToChange.CompanyPassword = newPassword;
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(companyToChange, System.Data.EntityState.Modified);
     }
 }
Example #9
0
 /// <summary>
 /// Method that saves a new user into the 'users' table.
 /// </summary>
 /// <param name="newUser"></param>
 /// <returns></returns>
 public long SaveUser(user newUser)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.users.AddObject(newUser);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(newUser, System.Data.EntityState.Added);
         return(newUser.UserId);
     }
 }
Example #10
0
 /// <summary>
 /// Method that saves a given question into the 'questions' table.
 /// </summary>
 /// <param name="newQuestion"></param>
 /// <returns></returns>
 public long SaveQuestion(question newQuestion)
 {
     using (var context = new TreasureHuntEntities())
     {
         context.questions.AddObject(newQuestion);
         context.SaveChanges();
         context.ObjectStateManager.ChangeObjectState(newQuestion, System.Data.EntityState.Added);
         return(newQuestion.QuestionId);
     }
 }