Guest User

Untitled

a guest
Feb 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. public class Users
  2. {
  3. public int UserId { get; set; }
  4. public String Username { get; set; }
  5. public virtual ICollection<Role> Roles { get; set; }
  6. }
  7. public class Role
  8. {
  9. public int RoleId { get; set; }
  10. public string RoleName { get; set; }
  11. public virtual ICollection<Users> Users { get; set; }
  12. }
  13.  
  14. enum TypeofEmp{
  15. Admin=100,
  16. HttpRequest=101,
  17. Devoloper=102
  18. };
  19. public Users GetUsers(string Uname, string psw)
  20. {
  21.  
  22. var x = (from n in db.Users
  23. where n.Username == Uname && n.Password == psw
  24. select n).FirstOrDefault();
  25. if(x!=null){
  26. int RoleId = x.RoleId;
  27. var RoleNmae = Enum.GetName(typeof(TypeofEmp), RoleId);
  28. Role dd = new Role(); dd.RoleId = RoleId; dd.RoleName = RoleNmae;
  29. }
  30. return x;
Add Comment
Please, Sign In to add comment