示例#1
0
 public InserirPlayListResponse InserirPlayList(InserirPlayListRequest pInserirPlayListRequest)
 {
     try
     {
         var inserirPlayList = _canalIlhasDAL.InserirPlayList(pInserirPlayListRequest);
         return(new InserirPlayListResponse {
             Mensagem = MensagensService.SUCESSO
         });
     }
     catch (Exception e)
     {
         throw;
     }
 }
示例#2
0
        public Int64 InserirPlayList(InserirPlayListRequest pInserir)
        {
            using (OracleConnection conexao = new OracleConnection(_configuration.GetConnectionString("DESENV")))
            {
                var   sSql = "SELECT SQ_CILHAS_PLAYLIST.NEXTVAL FROM DUAL";
                Int64 SQ   = Convert.ToInt32(conexao.QueryFirstOrDefault <Int64>(sSql, null));
                //sSql = "SELECT SQ_CILHAS_UPLOAD_PLAYLIST.NEXTVAL FROM DUAL";
                //Int64 SQRel = Convert.ToInt32(conexao.QueryFirstOrDefault<Int64>(sSql, null));

                conexao.Open();
                OracleCommand     command     = conexao.CreateCommand();
                OracleTransaction transaction = conexao.BeginTransaction();
                try
                {
                    sSql = "INSERT INTO TB_CILHAS_PLAYLIST(ID_PLAYLIST, NM_PLAYLIST, TP_PLAYLIST, NM_CAS) values(:ID_PLAYLIST, :NM_PLAYLIST, :TP_PLAYLIST, :NM_CAS)";
                    var pTranparameters = new { ID_PLAYLIST = SQ, NM_PLAYLIST = pInserir.PlayList.NM_PLAYLIST, TP_PLAYLIST = pInserir.PlayList.TP_PLAYLIST, NM_CAS = pInserir.PlayList.NM_CAS };
                    conexao.Execute(sSql, pTranparameters, transaction);

                    var arquivosParaUpload = pInserir.PlayList.TP_PLAYLIST.Split(",");

                    foreach (var aUpload in arquivosParaUpload)
                    {
                        sSql = "INSERT INTO TB_CILHAS_UPLOAD_PLAYLIST(ID_UPLOAD_PLAYLIST, CD_ARQUIVO_UPLOAD, CD_PLAYLIST) values(SQ_CILHAS_UPLOAD_PLAYLIST.NEXTVAL, :CD_ARQUIVO_UPLOAD, :CD_PLAYLIST)";
                        var sTranparameters = new { CD_ARQUIVO_UPLOAD = Convert.ToInt32(aUpload), CD_PLAYLIST = SQ };
                        conexao.Execute(sSql, sTranparameters, transaction);

                        transaction.Commit();
                    }

                    conexao.Close();

                    return(SQ);
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    conexao.Close();
                    throw;
                }
            }
        }
 public InserirPlayListResponse InserirPlayList([FromBody] InserirPlayListRequest pInserirPlayListRequest)
 {
     return(_canalIlhasService.InserirPlayList(pInserirPlayListRequest));
 }
示例#4
0
 public InserirPlayListResponse InserirPlayList(InserirPlayListRequest pInserirPlayListRequest)
 {
     return(Http.Post <InserirPlayListResponse>("v1/api/CanalIlhas/InserirPlayList", pInserirPlayListRequest));
 }