Ejemplo n.º 1
0
        public JsonResult Put(PeopleSkills ps)
        {
            string        query         = @"
                       update dbo.PeopleSkills set
                       PersonID='" + ps.PersonID + @"'
                       ,SkillID='" + ps.SkillID + @"'
                       where PersonSkillID=" + ps.PersonSkillID + @"
                       ";
            DataTable     table         = new DataTable();
            string        sqlDataSource = _configuration.GetConnectionString("LUCapstoneDB");
            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"));
        }
Ejemplo n.º 2
0
        public JsonResult Post(PeopleSkills ps)
        {
            string        query         = @"
                       insert into dbo.PeopleSkills values
                       (
						'"                         + ps.PersonID + @"'
						,'"                         + ps.SkillID + @"'
                       )
                        ";
            DataTable     table         = new DataTable();
            string        sqlDataSource = _configuration.GetConnectionString("LUCapstoneDB");
            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"));
        }