public IHttpActionResult EditMeal(int id, MealModels.MealInputModel mealModel)
        {
            var userId = HttpContext.Current.User.Identity.GetUserId();
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var searchedMeal = this.Data.Meals.All().FirstOrDefault(m => m.Id == id);
            if (searchedMeal == null)
            {
                return this.NotFound();
            }

            if (searchedMeal.Restaurant.OwnerId != userId)
            {
                return this.Unauthorized();
            }

            searchedMeal.Name = mealModel.name;
            searchedMeal.Price = mealModel.price;
            searchedMeal.TypeId = mealModel.typeId;
            this.Data.SaveChanges();

            var outputData = this.Data.Meals.All().Where(x => x.Id == searchedMeal.Id).Select(MealModels.MealOutputModel.Parse);
            return this.Created(Location + id, outputData);
        }
        public IHttpActionResult CreateMeal(MealModels.MealInputModel mealModel)
        {
            var userId = HttpContext.Current.User.Identity.GetUserId();
            if (!this.ModelState.IsValid)
            {
                return this.BadRequest(this.ModelState);
            }

            var restaurant = this.Data.Restaurants.All().FirstOrDefault(r => r.Id == mealModel.restaurantId);
            if (restaurant.OwnerId != userId)
            {
                return this.Unauthorized();
            }

            Meal newMeal = new Meal
            {
                Name = mealModel.name,
                Price = mealModel.price,
                TypeId = mealModel.typeId,
                RestaurantId = (int)mealModel.restaurantId
            };

            this.Data.Meals.Add(newMeal);
            this.Data.SaveChanges();

            var outputData = this.Data.Meals.All().Where(x => x.Id == newMeal.Id).Select(MealModels.MealOutputModel.Parse);

            return this.Created(Location + newMeal.Id, outputData);
        }