public async Task <IActionResult> Index() { var user = await _userManager.GetUserAsync(HttpContext.User); if (user == null) { return(NotFound()); } UserDayEditModel model = new UserDayEditModel() { DayDate = DateTime.Now, //ShowComplex = user.MenuType.HasValue && (user.MenuType.Value & 1) > 0, //ShowDishes = user.MenuType.HasValue && (user.MenuType.Value & 2) > 0, ShowComplex = (_userdaydishesrepo.GetCompanyOrderType(this.User.GetHotelID()) & (OrderTypeEnum.OneComplexType | OrderTypeEnum.Complex)) > 0, ShowDishes = (_userdaydishesrepo.GetCompanyOrderType(this.User.GetHotelID()) & OrderTypeEnum.Dishes) > 0 }; DateTime daydate = DateTime.Now; //daydate = daydate.AddDays(1); if (daydate.DayOfWeek == DayOfWeek.Saturday || daydate.DayOfWeek == DayOfWeek.Sunday) { daydate = daydate.AddDays(2); } DateTime startDate = daydate.StartOfWeek(DayOfWeek.Monday); DateTime endDate = startDate.AddDays(6); //var list = _userdaydishesrepo.DishesKind(startDate, endDate, User.GetCompanyID()); //ViewData["DishKindId"] = new SelectList(list, "Value", "Text", list.FirstOrDefault()); return(View(model)); //await _userdishes.CategorizedDishesPerDay(DateTime.Now, _userManager.GetUserId(HttpContext.User)).ToListAsync()); }
//private List<SelectListItem> GetDishesKindWithEmptyList() //{ // List<SelectListItem> disheskind = _context.DishesKind.AsNoTracking() // .OrderBy(n => n.Code).Select(n => // new SelectListItem // { // Value = n.Id.ToString(), // Text = n.Name // }).ToList(); // //disheskind.FirstOrDefault().Selected = true; // //var empty = new SelectListItem() { Value = "", Text = _localizer["All"] }; // // disheskind.Insert(0, empty); // return disheskind; //} public async Task <IActionResult> EditUserDay(DateTime daydate, int dishKind) { var user = await _userManager.GetUserAsync(HttpContext.User); if (user == null) { return(NotFound()); } UserDayEditModel model = new UserDayEditModel() { DayDate = daydate, DayMenu = new DayMenu() { Date = daydate }, ShowComplex = (_userdaydishesrepo.GetCompanyOrderType(this.User.GetHotelID()) & (OrderTypeEnum.OneComplexType | OrderTypeEnum.Complex)) > 0, //ShowComplex = user.MenuType.HasValue && (user.MenuType.Value & 1) > 0, ShowDishes = (_userdaydishesrepo.GetCompanyOrderType(this.User.GetHotelID()) & OrderTypeEnum.Dishes) > 0 }; return(PartialView(model)); }