Пример #1
0
        /// <summary>
        /// Cart Page
        /// </summary>
        public async Task <IActionResult> Index()
        {
            var list = (await _ordersAppService.GetAllByUser(_inputSearch)).Items
                       .Where(m => m.OrderStatus == OrderStatus.Created);

            return(View(list));
        }
Пример #2
0
        public async Task <ActionResult> Index()
        {
            var orders = (await _ordersAppService.GetAllByUser(_inputSearch)).Items;
            var users  = _user.UserType == UserType.User
                ? new List <UserDto> {
                await _accountAppService.MyProfile(_user.Id)
            }                                                         //if user is client get only his info
                : (await _userAppService.GetAll(_inputSearch)).Items; //else get all clients
            //add client info to order list
            var model = (from item in orders
                         let user = users.FirstOrDefault(m => m.Id == item.UserId)
                                    where user != null
                                    select new OrderListViewModel
            {
                Guid = item.Guid,
                CurrentLeague = item.CurrentLeague,
                CurrentPoints = item.CurrentPoints,
                CurrentDivision = item.CurrentDivision,
                QueueType = item.QueueType,
                ServerName = item.ServerName,
                ServiceType = item.ServiceType,
                BoostType = item.BoostType,
                OrderStatus = item.OrderStatus,
                CreatorUserId = item.CreatorUserId,
                UserId = item.UserId,             //we write the name of the use who works with this order
                Username = user.UserName
            }).ToList();

            ViewBag.isUser = _user.UserType == UserType.User;
            return(View("Index", model));
        }