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)); }
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)); }