public IActionResult GetMiscellaneous(int id) { LunchMiscellaneous result = _lunchRepository.GetMiscellaneous(id); var route = "~/Views/Lunch/MiscellaneousDetail.cshtml"; return(PartialView(route, result)); }
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); }
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); }