public Address Update(Address address) { var sqlQuery = "UPDATE Address " + "SET Line1 = @Line1, " + " Line2 = @Line2, " + " City = @City, " + " State = @State, " + " Zip = @Zip " + "WHERE Id = @Id"; this._db.Execute(sqlQuery, address); return address; }
public Address Add(Address address) { var sqlQuery = "INSERT INTO Address" + "(Line1, " + "Line2, " + "City, " + "State, " + "Zip) VALUES" + "(@Line1, " + "@Line2, " + "@City, " + "@State, " + "@Zip)" + "SELECT CAST(SCOPE_IDENTITY() as int)"; var addressId = this._db.Query<int>(sqlQuery, address).Single(); address.Id = addressId; return address; }