public IHttpResponse Shipped() { var shippedPackages = new ShippedPackagesViewModel() { ShippedPackages = this.Db.Packages.Where(x => x.Status == PackageStatus.Shipped) .Select(x => new PackageAdminBaseViewModel() { Id = x.Id, Description = x.Description, Weight = x.Weight, EstimatedDeliveryDate = x.EstimatedDeliveryDate == null ? x.EstimatedDeliveryDate.ToString() : x.EstimatedDeliveryDate.Value.ToString("d"), Recipient = x.Recipient.Username, }) }; return(this.View("/Packages/Admin/Shipped", shippedPackages)); }
public IHttpResponse Shipped() { var shippedPackages = this.db.Packages .Where(s => s.Status == Status.Shipped) .Select(vm => new PackageAdminViewModel { Id = vm.Id, Description = vm.Description, Weight = vm.Weight, ShippingAddress = vm.ShippingAddress, Recipient = vm.Recipient.Username }) .ToList(); var pendingPackagesViewModel = new ShippedPackagesViewModel { ShippedPackages = shippedPackages }; return(this.View(pendingPackagesViewModel)); }