Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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));
            }
        }
Exemplo n.º 3
0
 public void Post([FromBody] Food value)
 {
     foodDao.AddFood(value);
     Request.CreateResponse(HttpStatusCode.Created, value);
 }