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); } }
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); } }
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); } }