Esempio n. 1
0
        public ActionResult DeleteConfirmed(decimal id)
        {
            var resParam = new OracleParameter("result", OracleDbType.Decimal, System.Data.ParameterDirection.Output);

            SqlUtility.ExecuteStoredProcedure(db, "DELETE_POLL(:id, :result)", new OracleParameter("id", id), resParam);
            var result = ((Oracle.ManagedDataAccess.Types.OracleDecimal)resParam.Value).Value;

            if (result < 0)
            {
                return(BadRequest());
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind("Id", "TerritoryName")] Terrtitory terrtitory)
 {
     if (ModelState.IsValid)
     {
         var resParam = new OracleParameter("result", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
         SqlUtility.ExecuteStoredProcedure(db, "UPDATE_TERRITORY(:id, :name, :result)", new OracleParameter("id", terrtitory.Id), new OracleParameter("name", terrtitory.TerritoryName), resParam);
         var result = ((Oracle.ManagedDataAccess.Types.OracleDecimal)resParam.Value).Value;
         if (result < 0)
         {
             return(BadRequest());
         }
         return(RedirectToAction("Index"));
     }
     return(View(terrtitory));
 }
Esempio n. 3
0
 public ActionResult Edit([Bind("Id", "PollDate", "IdRespondent")] Poll poll)
 {
     if (ModelState.IsValid)
     {
         var resParam = new OracleParameter("result", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
         SqlUtility.ExecuteStoredProcedure(db, "UPDATE_POLL(:id, :id_respondent, :poll_date, :result)",
                                           new OracleParameter("id", poll.Id),
                                           new OracleParameter("id_respondent", poll.IdRespondent),
                                           new OracleParameter("poll_date", OracleDbType.Date, poll.PollDate, System.Data.ParameterDirection.Input),
                                           resParam);
         var result = ((Oracle.ManagedDataAccess.Types.OracleDecimal)resParam.Value).Value;
         if (result < 0)
         {
             return(BadRequest());
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.IdRespondent = new SelectList(db.Respondents, "Id", "Surname", poll.IdRespondent);
     return(View(poll));
 }
Esempio n. 4
0
 public ActionResult Edit([Bind("Id", "Text", "IdPolitician")] Orders orders)
 {
     if (ModelState.IsValid)
     {
         var resParam = new OracleParameter("result", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
         SqlUtility.ExecuteStoredProcedure(db, "UPDATE_ORDERS(:id, :text, :id_politician, :result)",
                                           new OracleParameter("id", orders.Id),
                                           new OracleParameter("text", orders.Text),
                                           new OracleParameter("id_politician", orders.IdPolitician),
                                           resParam);
         var result = ((Oracle.ManagedDataAccess.Types.OracleDecimal)resParam.Value).Value;
         if (result < 0)
         {
             return(BadRequest());
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.IdPolitician = new SelectList(db.Politicians, "Id", "Surname", orders.IdPolitician);
     return(View(orders));
 }
 public ActionResult Edit([Bind("Id", "Name", "Surname", "Patro", "BirthDate")] Respondents respondents)
 {
     if (ModelState.IsValid)
     {
         var resParam = new OracleParameter("result", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
         SqlUtility.ExecuteStoredProcedure(db, "UPDATE_RESPONDENTS(:id, :name, :surname, :patro, :birthdate, :result)",
                                           new OracleParameter("id", respondents.Id),
                                           new OracleParameter("name", respondents.Name),
                                           new OracleParameter("surname", respondents.Surname),
                                           new OracleParameter("patro", respondents.Patro),
                                           new OracleParameter("birthdate", OracleDbType.Date, respondents.BirthDate, System.Data.ParameterDirection.Input),
                                           resParam);
         var result = ((Oracle.ManagedDataAccess.Types.OracleDecimal)resParam.Value).Value;
         if (result < 0)
         {
             return(BadRequest());
         }
         return(RedirectToAction("Index"));
     }
     return(View(respondents));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind("IdPoll", "IdPolitician", "Rating")] PoliticianSets politician_sets)
 {
     if (ModelState.IsValid)
     {
         var resParam = new OracleParameter("result", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
         SqlUtility.ExecuteStoredProcedure(db, "UPDATE_POLITICIAN_SETS(:id_poll, :id_politician, :rating, :result)",
                                           new OracleParameter("id_poll", politician_sets.IdPoll),
                                           new OracleParameter("id_politician", politician_sets.IdPolitician),
                                           new OracleParameter("rating", politician_sets.Rating),
                                           resParam);
         var result = ((Oracle.ManagedDataAccess.Types.OracleDecimal)resParam.Value).Value;
         if (result < 0)
         {
             return(BadRequest());
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.IdPolitician = new SelectList(db.Politicians, "Id", "Surname", politician_sets.IdPolitician);
     ViewBag.IdPoll       = new SelectList(db.Poll, "Id", "Id", politician_sets.IdPoll);
     return(View(politician_sets));
 }
 public ActionResult Edit([Bind("Id", "Name", "Surname", "Patro", "IdTerritory")] Politicians politicians)
 {
     if (ModelState.IsValid)
     {
         var resParam = new OracleParameter("result", OracleDbType.Decimal, System.Data.ParameterDirection.Output);
         SqlUtility.ExecuteStoredProcedure(db, "UPDATE_POLITICIANS(:id, :name, :surname, :patro, :id_territory, :result)",
                                           new OracleParameter("id", politicians.Id),
                                           new OracleParameter("name", politicians.Name),
                                           new OracleParameter("surname", politicians.Surname),
                                           new OracleParameter("patro", politicians.Patro),
                                           new OracleParameter("id_territory", politicians.IdTerritory),
                                           resParam);
         var result = ((Oracle.ManagedDataAccess.Types.OracleDecimal)resParam.Value).Value;
         if (result < 0)
         {
             return(BadRequest());
         }
         return(RedirectToAction("Index"));
     }
     ViewBag.IdTerritory = new SelectList(db.Terrtitory, "Id", "TerritoryName", politicians.IdTerritory);
     return(View(politicians));
 }
Esempio n. 8
0
 protected ICollection <T> ExecuteStoredProcedure(SqlCommand command)
 {
     command.Connection = _connection;
     return(SqlUtility.ExecuteStoredProcedure <T>(command));
 }