public JsonResult Post(WomenClothes clot) { string query = @" insert into dbo.womenclothes (WomenClothesName, WomenClothesPrice, WomenClothesQuantity, WomenClothesPhoto) values ( '" + clot.WomenClothesName + @"' ,'" + clot.WomenClothesPrice + @"' ,'" + clot.WomenClothesQuantity + @"' ,'" + clot.WomenClothesPhoto + @"' )"; 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")); }
public JsonResult Put(WomenClothes clot) { string query = @" update dbo.womenclothes set WomenClothesName = '" + clot.WomenClothesName + @"' ,WomenClothesPrice = '" + clot.WomenClothesPrice + @"' ,WomenClothesQuantity = '" + clot.WomenClothesQuantity + @"' ,WomenClothesPhoto = '" + clot.WomenClothesPhoto + @"' where WomenClothesID = " + clot.WomenClothesID + @" "; 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")); }
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(); }