//id is not needed since this should only be used by the method if they are making a new food
        private Extra ConvertExtraFormViewModelToExtra(ExtraFormViewModel extraVM)
        {
            Extra extra = new Extra
            {
                Name       = extraVM.Name,
                AddedPrice = extraVM.AddedPrice,
                FoodId     = extraVM.FoodId
            };

            return(extra);
        }
        public async Task <ActionResult> Save(ExtraFormViewModel extraVM)
        {
            Extra extraInDb = await _unitOfWork.Extras.SingleOrDefault(c => c.Id == extraVM.Id);

            if (extraInDb == null)
            {
                _unitOfWork.Extras.Add(ConvertExtraFormViewModelToExtra(extraVM));
            }
            else
            {
                extraInDb.Name       = extraVM.Name;
                extraInDb.AddedPrice = extraVM.AddedPrice;
            }

            await _unitOfWork.Complete();

            return(RedirectToAction("Edit", "Food", new { Id = extraVM.FoodId }));
        }