Guest User

Untitled

a guest
Nov 18th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Data.Objects;
  6. using System.Data.Objects.DataClasses;
  7.  
  8. namespace timepaceEF
  9. {
  10. public partial class User : timepaceEF.User
  11. {
  12. // Create an ObjectContext based on timespacEntities
  13. private timespaceEntities timespaceContext;
  14.  
  15. public User Validate(string email, string password)
  16. {
  17. timespaceContext = new timespaceEntities();
  18.  
  19. // define a query that returns any User matching the login info
  20. // throw a login error
  21. var query = from u in timespaceContext.Users
  22. where u.Email == email.Trim() && u.Password == password.Trim()
  23. select u;
  24.  
  25. return query.FirstOrDefault();
  26.  
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment