public async Task <ActionResult <IReadOnlyList <Menu> > > GetMenusForRestaurant(int id) { var spec = new MenuByRestaurant(id); var menus = await _unitOfWork.Repository <Menu>().GetEnititiesWithSpec(spec); return(Ok(menus)); }
public async Task <ActionResult <IReadOnlyList <Menu> > > GetMenusForManager() { var user = await _userManager.FindByEmailFromClaimsPrinciple(HttpContext.User); var restaurants = await _unitOfWork.Repository <Restaurant>().ListAllAsync(); foreach (var restaurant in restaurants) { if (restaurant.Name == user.DisplayName) { var spec = new MenuByRestaurant(user.DisplayName); return(Ok(await _unitOfWork.Repository <Menu>().ListAsync(spec))); } } ; return(Ok(await _unitOfWork.Repository <Menu>().ListAllAsync())); }