private void Button_Click(object sender, RoutedEventArgs e) { Food food = new Food { Name = name.Text, Calories = Convert.ToInt32(calories.Text), Grade = Convert.ToInt32(grade.Text), Ingridients = ingredients.Text }; foodDao.AddFood(food); }
public HttpResponseMessage Post([FromBody] Food f) { FoodDAOMSSQL foodDao = new FoodDAOMSSQL(); if (f == null) { return(Request.CreateResponse(HttpStatusCode.NoContent)); } else { foodDao.AddFood(f); return(Request.CreateResponse(HttpStatusCode.Created, f)); } }
public void Post([FromBody] Food value) { foodDao.AddFood(value); Request.CreateResponse(HttpStatusCode.Created, value); }