예제 #1
0
        public bool AddClub(AddClubCommand newClub)
        {
            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();

                var addClub = @"INSERT INTO [dbo].[Club]
	                                ([Name]
	                                ,[Address]
	                                ,[Phone]
	                                ,[Capacity]
	                                ,[Description])
                                 output inserted.*
                                 VALUES
	                                (@name
                                    ,@address
                                    ,@phone
                                    ,@capacity
                                    ,@description)";

                var parameters = new
                {
                    name        = newClub.Name,
                    address     = newClub.Address,
                    phone       = newClub.Phone,
                    capacity    = newClub.Capacity,
                    description = newClub.Description
                };

                var rowsAffected = connection.Execute(addClub, parameters);
                return(rowsAffected == 1);
            }
        }
예제 #2
0
        public void AddClub(AddClubCommand newClub)
        {
            var repo = new ClubRepository();

            repo.AddClub(newClub);
        }