public IHttpActionResult PutMeal(int id, MealBindingModel mealModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (!db.Meals.All().Any(m => m.Id == id))
            {
                return this.NotFound();
            }

            if (!User.Identity.IsAuthenticated)
            {
                return Unauthorized();
            }

            var meal = db.Meals.Find(id);

            meal.Name = mealModel.Name;
            meal.Price = mealModel.Price;
            meal.Type = db.MealTypes.Find(mealModel.TypeId);

            db.SaveChanges();

            return this.Ok(new MealViewModel()
            {
                Id = meal.Id,
                Name = meal.Name,
                Price = meal.Price,
                Type = meal.Type.Name
            });
        }
        public IHttpActionResult PostMeal(MealBindingModel mealModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest();
            }

            if (!db.Restaurants.All().Any(r => r.Id == mealModel.RestaurantId))
            {
                return BadRequest();
            }

            if (!User.Identity.IsAuthenticated)
            {
                return Unauthorized();
            }

            Meal newMeal = new Meal()
            {
                Name = mealModel.Name,
                Price = mealModel.Price,
                Restaurant = db.Restaurants.Find(mealModel.RestaurantId),
                RestaurantId = mealModel.RestaurantId,
                Type = db.MealTypes.Find(mealModel.TypeId),
                TypeId = mealModel.TypeId
            };

            db.Meals.Add(newMeal);
            db.SaveChanges();

            return CreatedAtRoute(
                "DefaultApi", 
                new { id = newMeal.Id }, 
                new MealViewModel()
                {
                    Id = newMeal.Id,
                    Name = newMeal.Name,
                    Price = newMeal.Price,
                    Type = newMeal.Type.Name
                });
        }