public IActionResult GetMiscellaneous(int id)
        {
            LunchMiscellaneous result = _lunchRepository.GetMiscellaneous(id);
            var route = "~/Views/Lunch/MiscellaneousDetail.cshtml";

            return(PartialView(route, result));
        }
Пример #2
0
        public LunchMiscellaneous AddMiscellaneous(int lunchId, string description, decimal price)
        {
            var lunch         = GetLunch(lunchId);
            var miscellaneous = new LunchMiscellaneous {
                Description = description, Price = price, Quantity = 1, Lunch = lunch
            };

            _appDbContext.LunchMiscellanea.Add(miscellaneous);
            _appDbContext.SaveChanges();
            return(miscellaneous);
        }
Пример #3
0
        public async Task <LunchMiscellaneous> AddMiscellaneousAsync(int lunchId, string description, decimal price)
        {
            var lunch = await GetLunchByIdAsync(lunchId);

            var miscellaneous = new LunchMiscellaneous {
                Description = description, Price = price, Quantity = 1, Lunch = lunch
            };
            await _appDbContext.LunchMiscellanea.AddAsync(miscellaneous);

            await _appDbContext.SaveChangesAsync();

            return(miscellaneous);
        }