示例#1
0
        public IActionResult Delivered()
        {
            var deliveredPackages = new DeliveredPackagesViewModel()
            {
                Packages = this.packageService
                           .GetAllForUserByStatus(this.User.Id, PackageStatus.Delivered)
                           .Select(x => new DeliveredPackageViewModel()
                {
                    Description     = x.Description,
                    ShippingAddress = x.ShippingAddress,
                    RecipientName   = x.Recipient.Username,
                    Weight          = x.Weight
                })
                           .ToList()
            };


            return(this.View(deliveredPackages));
        }
示例#2
0
        public IHttpResponse Delivered()
        {
            var deliveredPackages = this.db.Packages
                                    .Where(s => s.Status == Status.Delivered || s.Status == Status.Acquired)
                                    .Select(vm => new PackageAdminViewModel
            {
                Id              = vm.Id,
                Description     = vm.Description,
                Weight          = vm.Weight,
                ShippingAddress = vm.ShippingAddress,
                Recipient       = vm.Recipient.Username
            })
                                    .ToList();

            var deliveredPackagesViewModel = new DeliveredPackagesViewModel
            {
                DeliveredPackages = deliveredPackages
            };

            return(this.View(deliveredPackagesViewModel));
        }