Beispiel #1
0
 public bool Update(User user)
 {
     using (IDbConnection connection = OpenConnection())
     {
         return 1 == connection.Execute(
             string.Format(@"UPDATE `users` SET {0} WHERE `UserId` = @UserId;",
             SqlHelper.Sets(_userUpdateColumns)),
             user);
     }
 }
Beispiel #2
0
 public bool Add(User user)
 {
     using (IDbConnection connection = OpenConnection())
     {
         return 1 == connection.Execute(
             string.Format(@"INSERT INTO `users` ({0}) VALUES ({1});",
             SqlHelper.Columns(_userColumns),
             SqlHelper.Params(_userColumns)),
             user);
     }
 }
Beispiel #3
0
        public static User Create(CreateUser command)
        {
            User user = new User();
            user.State = UserState.Initial;

            user.EnsoureAndUpdateState(command);
            user.UserId = command.UserId;
            user.Name = command.Name;
            user.Email = command.Email;
            user.CreateAt = command.CreateAt;
            user.CreateBy = command.CreateBy;
            user.UpdateAt = command.CreateAt;
            user.UpdateBy = command.CreateBy;

            return user;
        }