Ejemplo n.º 1
0
 public User Add(User user)
 {
     var sqlQuery = "INSERT INTO Users (FirstName, LastName, Email) VALUES(@FirstName, @LastName, @Email); " + "SELECT CAST(SCOPE_IDENTITY() as int)";
     var userId = this._db.Query<int>(sqlQuery, user).Single();
     user.UserID = userId;
     return user;
 }
Ejemplo n.º 2
0
 public User Update(User user)
 {
     var sqlQuery =
         "UPDATE Users " +
         "SET FirstName = @FirstName, " +
         "    LastName  = @LastName, " +
         "    Email     = @Email " +
         "WHERE UserID = @UserID";
     this._db.Execute(sqlQuery, user);
     return user;
 }