Example #1
0
        public override DbCommandWrapper InitializeCommand(Database db, DataTransferObject insertObj)
        {
            Volume volumeDto = insertObj as Volume;

            //Create a database command object within which T-SQL commands can
            //be executed.
            DbCommandWrapper cw = DbCommandFactory.GetStoredProcCommandWrapper(db, "spInsertVolume");

            //Parameters are added here, update each line to reflect the parameter from
            //the subscription object
            cw.AddOutParameter("VolumeId", DbType.Int32, 4);

            cw.AddInParameter("VolumeName", DbType.String, volumeDto.VolumeName);

            cw.AddInParameter("VolumeYear", DbType.String, volumeDto.VolumeYear);

            cw.AddInParameter("Active", DbType.Boolean, volumeDto.IsActive);

            cw.AddInParameter("CreationUserId", DbType.Int32, volumeDto.CreationUserId);

            //Return the commandwrapper object to DALCHelper where the stored proc
            //will be executed
            return(cw);
        }