public JsonResult Put(MenClothes clot) { string query = @" update dbo.menclothes set MenClothesName = '" + clot.MenClothesName + @"' ,MenClothesPrice = '" + clot.MenClothesPrice + @"' ,MenClothesQuantity = '" + clot.MenClothesQuantity + @"' ,MenClothesPhoto = '" + clot.MenClothesPhoto + @"' where MenClothesID = " + clot.MenClothesID + @" "; DataTable table = new DataTable(); string sqlDataSource = _configuration.GetConnectionString("ClothesAppCon"); 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("Update Successful")); }
public JsonResult Post(MenClothes clot) { string query = @" insert into dbo.menclothes (MenClothesName, MenClothesPrice, MenClothesQuantity, MenClothesPhoto) values ( '" + clot.MenClothesName + @"' ,'" + clot.MenClothesPrice + @"' ,'" + clot.MenClothesQuantity + @"' ,'" + clot.MenClothesPhoto + @"' )"; DataTable table = new DataTable(); string sqlDataSource = _configuration.GetConnectionString("ClothesAppCon"); 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 Successful")); }
static void Main(string[] args) { WomenClothes womenclothes = new WomenClothes("trousers", "red", "famele", 30, 172); womenclothes.Display(); Console.WriteLine(womenclothes.SizeOfClothes(92, 72, 100)); MenClothes menclothes = new MenClothes("Coat", "black", "male", 40, 180); menclothes.Display(); BoysClothes boysclothes = new BoysClothes("Jacket", "White", "Male", 3, 80); boysclothes.Display(); Console.Read(); }