private async Task <List <RestaurantViewModel> > GetRestaurantViewModels(List <Guid> ids)
        {
            var filterOperation = await _rbo.FilterAsync(x => ids.Contains(x.Id));

            var drList = new List <RestaurantViewModel>();

            foreach (var item in filterOperation.Result)
            {
                drList.Add(RestaurantViewModel.Parse(item));
            }
            return(drList);
        }
Example #2
0
        public async Task <IActionResult> ClientBooking()
        {
            var user = await _uManager.FindByNameAsync(User.Identity.Name);

            if (user == null)
            {
                OperationErrorBackToIndex("Not a client");
            }

            var getClientRecords = await _crbo.FilterAsync(x => x.PersonId == user.PersonId);

            if (!getClientRecords.Success)
            {
                OperationErrorBackToIndex(getClientRecords.Exception);
            }

            var bookings = await _bo.FilterAsync(x => getClientRecords.Result.Select(y => y.Id).Contains(x.ClientId));

            var restaurants = await _rbo.FilterAsync(x => getClientRecords.Result.Select(y => y.RestaurantId).Contains(x.Id));

            ViewData["Header"] = "Bookings";

            return(View());
        }