Пример #1
0
 public UnitOfWork()
 {
     _context         = new MessengerClient_DBEntities();
     messagesRepo     = new MessagesRepository(_context);
     usersRolesRepo   = new UsersRepository(_context);
     rolesMappingRepo = new RolesRepository(_context);
 }
Пример #2
0
 public override string[] GetRolesForUser(string username)
 {
     using (MessengerClient_DBEntities _context = new MessengerClient_DBEntities())
     {
         var userRoles = (from user in _context.Users
                          join roleMapping in _context.UserRolesMapping
                          on user.ID equals roleMapping.UserID
                          join role in _context.RoleMaster
                          on roleMapping.RoleID equals role.ID
                          where user.Username.ToLower() == username.ToLower()
                          orderby role.RoleName
                          select role.RoleName).ToArray();
         return(userRoles);
     }
 }
 public MessagesRepository(MessengerClient_DBEntities context)
     : base(context)
 {
 }