Beispiel #1
0
 public bool UsernameIsExists(string usrname, int currentUserId)
 {
     using (var conn = Database.Open())
     {
         return(conn.ExecuteScalar <int>(UserSql.UsernameIsExists(currentUserId, usrname)) > 0);
     }
 }
Beispiel #2
0
 public Model.User.User FindBy(int key)
 {
     using (var con = Database.Open())
     {
         return(con.Query <Model.User.User>(UserSql.FindById(key)).FirstOrDefault());
     }
 }
Beispiel #3
0
 public IList <Model.User.User> FindAll()
 {
     using (var conn = Database.Open())
     {
         return(conn.Query <Model.User.User>(UserSql.FindAll()).ToArray());
     }
 }
Beispiel #4
0
 public void Update(Model.User.User item)
 {
     using (var conn = Database.Open())
     {
         var tuple = UserSql.Update(item);
         conn.Execute(tuple.Item1, (object)tuple.Item2);
     }
 }
Beispiel #5
0
 public Model.User.User FindBy(string username)
 {
     using (var conn = Database.Open())
     {
         var tuple = UserSql.FindByName(username);
         return(conn.Query <Model.User.User>(tuple.Item1, (object)tuple.Item2).FirstOrDefault());
     }
 }
Beispiel #6
0
 public void Add(Model.User.User item)
 {
     using (var conn = Database.Open())
     {
         var tuple = UserSql.Add(item);
         int id    = conn.ExecuteScalar <int>(tuple.Item1, (object)tuple.Item2);
         helper.SetValue(m => m.Id, item, id);
     }
 }