private void CreateListsToFormRegister(RegisterViewModel model) { var objFunctions = new Commons.functions(); model.listWhatHowFindUs = GetSelectListItems(objFunctions.GetAllTypeHowFindUsRegister()); model.listStates = GetSelectListItems(objFunctions.GetAllStatesRegister()); model.listTeams = GetSelectListItems(objFunctions.GetAllTeamsRegister()); model.listModes = GetSelectListItems(objFunctions.GetAllModesRegister()); objFunctions = null; }
public IHttpActionResult postAction(SpoolerViewModel model) { db.openConnection(); DataTable dt = null; var objFunctions = new Commons.functions(); try { if (model.actionUser.ToLower() == "add_spooler_draw_warning" || model.actionUser.ToLower() == "add_spooler_draw_done") { paramName = new string[] { "pIdCamp", "pDescription", "pTypeSpooler", "pIdUsuResponsible" }; paramValue = new string[] { Convert.ToString(model.championshipID), model.descriptionProcess, model.typeProcess, model.userIDResponsible.ToString() }; dt = db.executePROC("spAddSpoolerDraw", paramName, paramValue); if (dt.Rows.Count > 0) { model.totalSentEmails = Convert.ToInt32(dt.Rows[0]["TOTAL_EMAILS_SENT"].ToString()); } model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } } catch (Exception ex) { model.returnMessage = "errorPostSpooler_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } finally { db.closeConnection(); dt = null; objFunctions = null; } }
public IHttpActionResult SigninUser(UserLoginModel user) { if (user.actionUser == "Signin") { db.openConnection(); var objFunctions = new Commons.functions(); Boolean validPasswordLogin = false; UserDetailsModel userDetails = new UserDetailsModel(); DataTable dt = null; DataTable dt2 = null; string passwordBase64 = string.Empty; try { paramName = new string[] { "dsLogin" }; paramValue = new string[] { user.psnID }; dt = db.executePROC("spGetUsuarioByLogin", paramName, paramValue); if (dt.Rows.Count > 0) { if (user.password != string.Empty) { byte[] byt = System.Text.Encoding.UTF8.GetBytes(user.password); passwordBase64 = Convert.ToBase64String(byt); } SetDetailsUser(dt, userDetails); if (!string.IsNullOrEmpty(userDetails.currentTeam)) { paramName = new string[] { "idTime" }; paramValue = new string[] { userDetails.currentTeam }; dt2 = db.executePROC("spGetTime", paramName, paramValue); userDetails.currentTeam = dt2.Rows[0]["NM_TIME"].ToString(); } paramName = new string[] { "idUsu" }; paramValue = new string[] { Convert.ToString(userDetails.id) }; dt2 = db.executePROC("spGetTitlesWonForUser", paramName, paramValue); userDetails.totalTitlesWon = Convert.ToInt16(dt2.Rows[0]["TOTAL_TITLESWON"].ToString()); userDetails.totalVices = Convert.ToInt16(dt2.Rows[0]["TOTAL_VICES"].ToString()); if (userDetails.password.ToString() != userDetails.password20.ToString() && userDetails.password20.ToString() == String.Empty) { validPasswordLogin = objFunctions.validateOldEncryptionPassword(userDetails.password.ToString(), user.password, Convert.ToInt16(userDetails.id.ToString())); if (validPasswordLogin) { paramName = new string[] { "pIdUsuario", "pPassWDBase64" }; paramValue = new string[] { Convert.ToString(userDetails.id), passwordBase64 }; db.executePROCNonResult("spUpdadePassWDUsuario", paramName, paramValue); paramName = new string[] { "pIdUsuario" }; paramValue = new string[] { Convert.ToString(userDetails.id) }; db.executePROCNonResult("spUpdateUltimoAcesso", paramName, paramValue); userDetails.lastAccess = DateTime.Now; } } else { paramName = new string[] { "pIdUsuario", "pPassWDBase64" }; paramValue = new string[] { Convert.ToString(userDetails.id), passwordBase64 }; dt = db.executePROC("spValidatePasswdOfUsuario", paramName, paramValue); var rowVal = dt.Rows[0]; if (rowVal["COD_VALIDATION"].ToString() == "0") { validPasswordLogin = true; } else if (rowVal["COD_VALIDATION"].ToString() == "1") { validPasswordLogin = false; } else if (rowVal["COD_VALIDATION"].ToString() == "2") { validPasswordLogin = false; } } if (validPasswordLogin == true) { userDetails.returnMessage = "loginSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = userDetails.id }, userDetails)); } else { user = new UserLoginModel(); user.returnMessage = "loginFailed"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } } else { user = new UserLoginModel(); user.returnMessage = "UserNotFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } } catch (Exception ex) { user = new UserLoginModel(); user.returnMessage = "errorSigninUser_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } finally { db.closeConnection(); objFunctions = null; userDetails = null; dt = null; dt2 = null; } } else if (user.actionUser == "Register") { db.openConnection(); var objFunctions = new Commons.functions(); DataTable dt = null; string passwordBase64 = string.Empty; try { paramName = new string[] { "pdsPsn", "pNmUsuario", "pDsEmail" }; paramValue = new string[] { user.psnID, user.name, user.email }; dt = db.executePROC("spValidateRegistrationOfUsuarioNewUsuario", paramName, paramValue); var rowValRegister = dt.Rows[0]; if (rowValRegister["COD_VALIDATION"].ToString() == "0") { byte[] byt = System.Text.Encoding.UTF8.GetBytes(user.password); passwordBase64 = Convert.ToBase64String(byt); paramName = new string[] { "pNmUsuario", "pDsSenhaBase64", "pDsEmail", "pPsnId", "pInAtivo", "pDsFicouSabendo", "pDsQual", "pNmTime", "pDtNasc", "pDsEstado", "pInReceberAlerta", "pInReceberSit", "pInDesejaPartic", "pInModerador", "pDsPsnCadastro", "pIdUsuarioOperacao", "pPsnUsuarioOperacao", "pDsPaginaOperacao" }; string receiveWarningEachRound = Convert.ToBoolean(user.inEmailWarning) ? "1" : "0"; string receiveTeamTable = Convert.ToBoolean(user.inEmailTeamTable) ? "1" : "0"; string wishParticipate = Convert.ToBoolean(user.inParticipate) ? "1" : "0"; string userActive = Convert.ToBoolean(user.userActive) ? "1" : "0"; string userModerator = Convert.ToBoolean(user.userModerator) ? "1" : "0"; paramValue = new string[] { user.name, passwordBase64, user.email, user.psnID, userActive, user.howfindus, user.whathowfindus, user.team, user.birthday.ToString("dd/MM/yyyy") + ";[DATE-TYPE]", user.state, receiveWarningEachRound, receiveTeamTable, wishParticipate, userModerator, user.psnID, null, "NULL", "UserController.Register" }; dt = db.executePROC("spAddUsuario", paramName, paramValue); user.id = Convert.ToInt16(dt.Rows[0]["ID_USUARIO"].ToString()); user.returnMessage = "registerSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = user.id }, user)); } else if (rowValRegister["COD_VALIDATION"].ToString() == "1") { user.returnMessage = "PsnFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else if (rowValRegister["COD_VALIDATION"].ToString() == "2") { user.returnMessage = "NameFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else if (rowValRegister["COD_VALIDATION"].ToString() == "3") { user.returnMessage = "EmailFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else { user = new UserLoginModel(); user.returnMessage = "ValidationNotFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } } catch (Exception ex) { user = new UserLoginModel(); user.returnMessage = "errorRegisterUser_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } finally { db.closeConnection(); objFunctions = null; dt = null; } } else if (user.actionUser == "Update") { db.openConnection(); var objFunctions = new Commons.functions(); DataTable dt = null; string passwordBase64 = string.Empty; try { paramName = new string[] { "pIdUsuario", "pdsPsn", "pNmUsuario", "pDsEmail" }; paramValue = new string[] { Convert.ToString(user.id), user.psnID, user.name, user.email }; dt = db.executePROC("spValidateRegistrationOfUsuarioOldUsuario", paramName, paramValue); var rowValRegister = dt.Rows[0]; if (rowValRegister["COD_VALIDATION"].ToString() == "0") { paramName = new string[] { "pIdUsuario", "pNmUsuario", "pDsEmail", "pPsnId", "pInAtivo", "pDsFicouSabendo", "pDsQual", "pNmTime", "pDtNasc", "pDsEstado", "pInReceberAlerta", "pInReceberSit", "pInDesejaPartic", "pInModerador", "pDsPsnCadastro", "pIdUsuarioOperacao", "pPsnUsuarioOperacao", "pDsPaginaOperacao" }; string receiveWarningEachRound = Convert.ToBoolean(user.inEmailWarning) ? "1" : "0"; string receiveTeamTable = Convert.ToBoolean(user.inEmailTeamTable) ? "1" : "0"; string wishParticipate = Convert.ToBoolean(user.inParticipate) ? "1" : "0"; string userActive = Convert.ToBoolean(user.userActive) ? "1" : "0"; string userModerator = Convert.ToBoolean(user.userModerator) ? "1" : "0"; paramValue = new string[] { Convert.ToString(user.id), user.name, user.email, user.psnID, userActive, user.howfindus, user.whathowfindus, user.team, user.birthday.ToString("dd/MM/yyyy") + ";[DATE-TYPE]", user.state, receiveWarningEachRound, receiveTeamTable, wishParticipate, userModerator, user.psnRegister, Convert.ToString(user.idUserOperation), user.psnOperation, "UserController.Update" }; dt = db.executePROC("spUpdadeUsuario", paramName, paramValue); user.returnMessage = "updateSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = user.id }, user)); } else if (rowValRegister["COD_VALIDATION"].ToString() == "1") { user.returnMessage = "PsnFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else if (rowValRegister["COD_VALIDATION"].ToString() == "2") { user.returnMessage = "NameFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else if (rowValRegister["COD_VALIDATION"].ToString() == "3") { user.returnMessage = "EmailFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else { user = new UserLoginModel(); user.returnMessage = "ValidationNotFound"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } } catch (Exception ex) { user = new UserLoginModel(); user.returnMessage = "errorUpdateUser_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } finally { db.closeConnection(); objFunctions = null; dt = null; } } else if (user.actionUser == "ChangePassword") { db.openConnection(); var objFunctions = new Commons.functions(); UserDetailsModel userDetails = new UserDetailsModel(); string passwordBase64 = string.Empty; DataTable dt = null; try { if (user.current_password == string.Empty || user.password == string.Empty || user.confirm_password == string.Empty) { user = new UserLoginModel(); user.returnMessage = "emptyPasswordFields"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else if (user.password != user.confirm_password) { user = new UserLoginModel(); user.returnMessage = "newPasswordFieldsDifferent"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else if (user.current_password == user.password && user.password == user.confirm_password) { user = new UserLoginModel(); user.returnMessage = "newPasswordEqual"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } else { byte[] byt = System.Text.Encoding.UTF8.GetBytes(user.current_password); passwordBase64 = Convert.ToBase64String(byt); paramName = new string[] { "pIdUsuario", "pPassWDBase64" }; paramValue = new string[] { Convert.ToString(user.id), passwordBase64 }; dt = db.executePROC("spValidatePasswdOfUsuario", paramName, paramValue); var rowVal = dt.Rows[0]; if (rowVal["COD_VALIDATION"].ToString() == "0") { byte[] byt2 = System.Text.Encoding.UTF8.GetBytes(user.password); passwordBase64 = Convert.ToBase64String(byt2); paramName = new string[] { "pIdUsuario", "pPassWDBase64" }; paramValue = new string[] { Convert.ToString(user.id), passwordBase64 }; db.executePROCNonResult("spUpdadePassWDUsuario", paramName, paramValue); user.returnMessage = "changedSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = user.id }, user)); } else { user = new UserLoginModel(); user.returnMessage = "loginFailed"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } } } catch (Exception ex) { user = new UserLoginModel(); user.returnMessage = "errorChangePassword_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } finally { db.closeConnection(); objFunctions = null; userDetails = null; dt = null; } } else if (user.actionUser == "RankingSupporters") { db.openConnection(); DataTable dt = null; List <SupportesTeamModel> oList = new List <SupportesTeamModel>(); SupportesTeamModel supporters = new SupportesTeamModel(); RankingSupportersModel ranking = new RankingSupportersModel(); try { paramName = new string[] { }; paramValue = new string[] { }; dt = db.executePROC("spGetDetailsRankingSupporters", paramName, paramValue); ranking.dtUpdateFormated = dt.Rows[0]["DT_CADASTRO_FORMATADA"].ToString(); ranking.totalUser = Convert.ToInt16(dt.Rows[0]["TOTAL_USUARIO"].ToString()); paramName = new string[] { }; paramValue = new string[] { }; dt = db.executePROC("spGetListRankingSupporters", paramName, paramValue); var rowVal = dt.Rows[0]; for (var i = 0; i < dt.Rows.Count; i++) { supporters = new SupportesTeamModel(); supporters.teamName = dt.Rows[i]["NM_TIME"].ToString(); supporters.total = Convert.ToInt16(dt.Rows[i]["TOTAL"].ToString()); oList.Add(supporters); } ranking.listSupportesTeam = oList; ranking.returnMessage = "rankingSuccessfully"; return(CreatedAtRoute("DefaultApi", new { }, ranking)); } catch (Exception ex) { user = new UserLoginModel(); user.returnMessage = "errorRankingSupporters_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, user)); } finally { db.closeConnection(); oList = null; supporters = null; ranking = null; dt = null; } } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } }
public IHttpActionResult postAccepting(AcceptingNewSeasonViewModel model) { if (String.IsNullOrEmpty(model.dataBaseName)) { model.dataBaseName = GlobalVariables.DATABASE_NAME_ONLINE; } db.openConnection(model.dataBaseName); var objFunctions = new Commons.functions(); AcceptingNewSeasonViewModel mainModel = new AcceptingNewSeasonViewModel(); AcceptingDetails modelDetails = new AcceptingDetails(); DataTable dt = null; try { if (model.actionUser == "save") { if (String.IsNullOrEmpty(model.confirmation)) { model.confirmation = null; } if (String.IsNullOrEmpty(model.teamName)) { model.teamName = null; } paramName = new string[] { "pIdTemporada", "pIdCampeonato", "pIdUsu", "pInConfirm", "pInOrdernacao", "pNmTimeFUT" }; paramValue = new string[] { Convert.ToString(model.seasonID), Convert.ToString(model.championshipID), Convert.ToString(model.userID), model.confirmation, model.ordering, model.teamName }; dt = db.executePROC("spAddUpdateConfirmacaoTemporada", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser == "getAllAccepting-staging") { model.listOfAccepting = getAllAccepting(db); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser == "getAccepting-staging") { modelDetails = GetAccepting(db, model.seasonID, model.userID, model.championshipID); modelDetails.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, modelDetails)); } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } } catch (Exception ex) { model.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } finally { db.closeConnection(); mainModel = null; dt = null; modelDetails = null; } }
public IHttpActionResult blog(BlogDetailsModel model) { db.openConnection("Connection.Database.Blog"); DataTable dt = null; var objFunctions = new Commons.functions(); try { if (model.actionUser.ToLower() == "dellcrud") { paramName = new string[] { "pIdUser", "pIdBlog" }; paramValue = new string[] { Convert.ToString(model.userID), Convert.ToString(model.id) }; dt = db.executePROC("spDeleteBlog", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser.ToLower() == "save" && model.id > 0) { paramName = new string[] { "pIdUser", "pIdBlog", "pTitle", "pText" }; paramValue = new string[] { Convert.ToString(model.userID), Convert.ToString(model.id), model.title, model.text + "@[LONGTEXT-TYPE]" }; dt = db.executePROC("spUpdateBlog", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = model.id }, model)); } else if (model.actionUser.ToLower() == "save" && model.id == 0) { paramName = new string[] { "pIdUser", "pTitle", "pDate", "pHour", "pText" }; paramValue = new string[] { Convert.ToString(model.userID), model.title, model.registerDate.ToString("dd/MM/yyyy") + ";[DATE-TYPE]", model.registerTime, model.text + "@[LONGTEXT-TYPE]" }; dt = db.executePROC("spAddBlog", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = model.id }, model)); } else if (model.actionUser.ToLower() == "sendWarningEmail") { //coding model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = model.id }, model)); } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } } catch (Exception ex) { model.returnMessage = "errorPostBlog_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } finally { db.closeConnection(); dt = null; objFunctions = null; } }
public IHttpActionResult team(TeamDetailsModel model) { db.openConnection(); DataTable dt = null; var objFunctions = new Commons.functions(); try { if (model.actionUser.ToLower() == "dellcrud") { paramName = new string[] { "idTime" }; paramValue = new string[] { Convert.ToString(model.id) }; dt = db.executePROC("spDeleteTime", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser.ToLower() == "save" && model.id > 0) { paramName = new string[] { "pIdTime", "pNmTime", "pdsUrl", "pIdTipo", "pIdTimeSofifa", "pIdTecnico" }; paramValue = new string[] { Convert.ToString(model.id), model.name, model.teamSofifaURL, Convert.ToString(model.typeModeID), Convert.ToString(model.teamSofifaID), Convert.ToString(model.userID) }; dt = db.executePROC("spAddTime", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = model.id }, model)); } else if (model.actionUser.ToLower() == "save" && model.id == 0) { paramName = new string[] { "pNmTime", "pdsUrl", "pIdTipo", "pIdTimeSofifa", "pIdTecnico" }; paramValue = new string[] { model.name, model.teamSofifaURL, Convert.ToString(model.typeModeID), Convert.ToString(model.teamSofifaID), Convert.ToString(model.userID) }; dt = db.executePROC("spAddTime", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = model.id }, model)); } else if (model.actionUser.ToLower() == "updateteamplayerslist") { string getHtmlSofifaTeamPlayersList = objFunctions.getTeamSofifaHTML(model.teamSofifaURL); processSofifaHTML(getHtmlSofifaTeamPlayersList, ref model); return(CreatedAtRoute("DefaultApi", new { id = model.id }, model)); } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } } catch (Exception ex) { model.returnMessage = "errorPostTeam_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } finally { db.closeConnection(); dt = null; objFunctions = null; } }
public IHttpActionResult postBench(BenchModesViewModel model) { db.openConnection(); var objFunctions = new Commons.functions(); BenchDetailsModel benchPlayersModel = new BenchDetailsModel(); BenchModesViewModel listBenchPlayers = new BenchModesViewModel(); List <BenchDetailsModel> listOfBench = new List <BenchDetailsModel>(); DataTable dt = null; try { if (model.actionUser == "listMainPage") { string[] typeOfBench = { "H2H", "FUT", "PRO" }; for (int i = 0; i < typeOfBench.Length; i++) { paramName = new string[] { "pTpBancoReserva" }; paramValue = new string[] { typeOfBench[i] }; dt = db.executePROC("spGetAllBancoReservaByTipo", paramName, paramValue); if (dt.Rows.Count > 0) { for (int j = 0; j < dt.Rows.Count; j++) { benchPlayersModel = new BenchDetailsModel(); benchPlayersModel.id = Convert.ToInt16(dt.Rows[j]["ID_BANCO_RESERVA"]); benchPlayersModel.userID = Convert.ToInt16(dt.Rows[j]["ID_USUARIO"]); benchPlayersModel.name = dt.Rows[j]["NM_USUARIO"].ToString(); benchPlayersModel.psnID = dt.Rows[j]["PSN_ID"].ToString(); benchPlayersModel.state = dt.Rows[j]["DS_ESTADO"].ToString(); benchPlayersModel.team = dt.Rows[j]["NM_TIME_FUT"].ToString(); benchPlayersModel.typeBench = typeOfBench[i]; listOfBench.Add(benchPlayersModel); } } } listBenchPlayers.listOfBench = listOfBench; listBenchPlayers.returnMessage = "getBenchSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, listBenchPlayers)); } else if (model.actionUser == "dellCrud") { BenchDetailsModel oDetails = model.listOfBench[0]; paramName = new string[] { "pIdBancoReserva" }; paramValue = new string[] { Convert.ToString(oDetails.id) }; dt = db.executePROC("spUpdateToEndBancoReservaById", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser == "moveCrud") { BenchDetailsModel oDetails = model.listOfBench[0]; paramName = new string[] { "pIdBancoReserva" }; paramValue = new string[] { Convert.ToString(oDetails.id) }; dt = db.executePROC("spAddBancoReservaToEndOfQueue", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else if (model.actionUser == "addCrud") { BenchDetailsModel oDetails = model.listOfBench[0]; paramName = new string[] { "pIdUsu", "pNmTime", "pTpBanco" }; paramValue = new string[] { Convert.ToString(oDetails.userID), oDetails.team, oDetails.typeBench }; dt = db.executePROC("spAddBancoReserva", paramName, paramValue); model.returnMessage = "ModeratorSuccessfully"; return(CreatedAtRoute("DefaultApi", new { id = 0 }, model)); } else { return(StatusCode(HttpStatusCode.NotAcceptable)); } } catch (Exception ex) { listBenchPlayers = new BenchModesViewModel(); listBenchPlayers.returnMessage = "error_" + ex.Message; return(CreatedAtRoute("DefaultApi", new { id = 0 }, listBenchPlayers)); } finally { db.closeConnection(); benchPlayersModel = null; listBenchPlayers = null; listOfBench = null; dt = null; } }