Esempio n. 1
0
        public JsonResult Put(StatusiPuntorit stat)
        {
            string        query         = @"
                    update StatusiPuntorit set 
                    Statusi = '" + stat.Statusi + @"'
                    where Id  = " + stat.Id + @" 
                    ";
            DataTable     table         = new DataTable();
            string        sqlDataSource = _configuration.GetConnectionString("ElavingApp");
            SqlDataReader myReader;

            using (SqlConnection myCon = new SqlConnection(sqlDataSource))
            {
                myCon.Open();
                using (SqlCommand myCommand = new SqlCommand(query, myCon))
                {
                    myReader = myCommand.ExecuteReader();
                    table.Load(myReader);;

                    myReader.Close();
                    myCon.Close();
                }
            }

            return(new JsonResult("Updated Successfully"));
        }
Esempio n. 2
0
        public JsonResult Post(StatusiPuntorit stat)
        {
            string        query         = @"
                    insert into StatusiPuntorit values
                    ('" + stat.Statusi + @"')
                    ";
            DataTable     table         = new DataTable();
            string        sqlDataSource = _configuration.GetConnectionString("ElavingApp");
            SqlDataReader myReader;

            using (SqlConnection myCon = new SqlConnection(sqlDataSource))
            {
                myCon.Open();
                using (SqlCommand myCommand = new SqlCommand(query, myCon))
                {
                    myReader = myCommand.ExecuteReader();
                    table.Load(myReader);;

                    myReader.Close();
                    myCon.Close();
                }
            }

            return(new JsonResult("Added Successfully"));
        }