示例#1
0
        public bool AddImage(ImageDTO img)
        {
            using (SqlConnection connection = new SqlConnection(config.ConnectionString))
            {
                SqlCommand command = helper.IntializeCommand(
                    "[dbo].[Image.AddImage]",
                    connection,
                    new string[] { "@OwnerId", "@Bytes", "@DataType" },
                    new object[] { img.OwnerId, img.Data, img.Type }
                    );

                connection.Open();
                int countRow = command.ExecuteNonQuery();

                return(countRow > 0);
            }
        }
示例#2
0
        public int AddAward(AwardDTO award)
        {
            using (SqlConnection connection = new SqlConnection(config.ConnectionString))
            {
                SqlCommand command = helper.IntializeCommand(
                    "[dbo].[Award.AddAward]",
                    connection,
                    new string[] { "@Title", "@Description", "@ImageId" },
                    new object[] { award.Title, award.Description, award.ImageId }
                    );

                connection.Open();
                int id = (int)(decimal)command.ExecuteScalar();

                return(id);
            }
        }
示例#3
0
        public int AddUser(UserDTO user)
        {
            using (SqlConnection connection = new SqlConnection(config.ConnectionString))
            {
                SqlCommand command = helper.IntializeCommand(
                    "[dbo].[User.AddUser]",
                    connection,
                    new string[] { "@Name", "@Birthdate", "@ImageId" },
                    new object[] { user.Name, user.BirthDate, user.ImageId }
                    );

                connection.Open();
                int id = (int)(decimal)command.ExecuteScalar();

                return(id);
            }
        }