示例#1
0
        public async Task <CateringDetailModel> GetSingleCateringDetails([FromRoute] int cateringId)
        {
            Catering catering = await cateringDbContext.Caterings
                                .Include(x => x.CateringEmployees)
                                .ThenInclude(x => x.User)
                                .Include(x => x.CateringDishes)
                                .ThenInclude(x => x.Dish)
                                .ThenInclude(x => x.DishType)
                                .Include(x => x.Vehicle)
                                .FirstOrDefaultAsync(x => x.CateringId == cateringId);

            CateringDetailModel model = catering.GetCateringDetailModel();

            return(model);
        }
示例#2
0
        public async Task <IActionResult> GetCateringDetailPartialView([FromRoute] int cateringId)
        {
            Catering catering = await cateringDbContext.Caterings
                                .Include(x => x.CateringEmployees)
                                .ThenInclude(x => x.User)
                                .Include(x => x.CateringDishes)
                                .ThenInclude(x => x.Dish)
                                .ThenInclude(x => x.DishType)
                                .Include(x => x.Vehicle)
                                .FirstOrDefaultAsync(x => x.CateringId == cateringId);

            CateringDetailModel model = catering.GetCateringDetailModel();

            string viewPath = @"\Views\Caterings\_CateringDetailModalContentPartial.cshtml";

            return(PartialView(viewPath, model));
        }