public UserContract ValidateLogin(string email, string password)
 {
     using (var dbConnector = new DBConnector())
     {
         UserManager userManager = new UserManager(dbConnector.DataContext);
         var         user        = userManager.ValidateLogin(email, password);
         return(UsersTranslator.ConvertToUserContract(user));
     }
 }
 public List <UserContract> Search(Func <dynamic, bool> criteria)
 {
     using (var dbConnector = new DBConnector())
     {
         UserManager       userManager  = new UserManager(dbConnector.DataContext);
         Func <User, bool> userCriteria = (Func <User, bool>)criteria;
         return(UsersTranslator.ConvertToUserContract(userManager.Search(userCriteria)).ToList());
     }
 }
 public List <UserContract> GetUsersByRoleId(int roleId)
 {
     using (var dbConnector = new DBConnector())
     {
         UserManager userManager = new UserManager(dbConnector.DataContext);
         var         users       = userManager.GetUsersByRoleId(roleId);
         return(UsersTranslator.ConvertToUserContract(users).ToList());
     }
 }
 public UserContract GetById(int userId)
 {
     using (var dbConnector = new DBConnector())
     {
         UserManager userManager = new UserManager(dbConnector.DataContext);
         var         user        = userManager.GetById(userId);
         return(UsersTranslator.ConvertToUserContract(user));
     }
 }