I want to show in the List only the items where "DataSfarsit" < Datetime.Now.
How can I do that?
controller:
- [Authorize]
- public ActionResult Create()
- {
- ViewBag.IDLicitatie = new SelectList(db.Licitatie, "IDLicitatie", "IDLicitatie").Where(...);
- ViewBag.IdUser = db.Useri.FirstOrDefault(x => x.Email == User.Identity.Name).IdUser;
- return View();
- }
- public partial class Licitatie
- {
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
- public Licitatie()
- {
- this.Oferte = new HashSet
(); - }
- public int IDLicitatie { get; set; }
- public System.DateTime DataPornire { get; set; }
- public System.DateTime DataIncheiere { get; set; }
- public decimal PretInitial { get; set; }
- public int IDProdus { get; set; }
- public virtual Produse Produse { get; set; }
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
- public virtual ICollection
Oferte { get; set; }
So basically I want the IDLicitate = "4" from there to not appear because it has DataSfarsit < Datetime.now.
Sachin SinghPosted May 7, 2021, 8:45 AM