Player IQuery <Player> .Execute(ICommandQuery commandQuery) { var sql = @"Insert into Players (FirstName, LastName, Email, Phone, RatingId, TeamId) values (@FirstName, @LastName, @Email, @Phone, @RatingId, @TeamId); select cast(scope_identity() as int)"; _player.Id = commandQuery.Query <int>(sql, _player).First(); return(_player); }
Team IQuery <Team> .Execute(ICommandQuery commandQuery) { var sql = @"Insert into Teams (Gender, Name, RatingId) values (@Gender, @Name, @RatingId); select cast(scope_identity() as int)"; _team.Id = commandQuery.Query <int>(sql, _team).First(); return(_team); }
public IEnumerable <Rating> Execute(ICommandQuery commandQuery) { return(commandQuery.Query <Rating>("select * from Ratings")); }