сделать?
public class Order { //[DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int OrderId { get; set; } public string NameClient { get; set; } public string PhoneClient { get; set; } public decimal PayClient { get; set; } public DateTime DateCreateOrder { get; set; } [ForeignKey("Statuses")] public int StatusId { get; set; } public DateTime DateLastModifOrder { get; set; } public Status Statuses { get; set; } } public class Status { //[DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int StatusId { get; set; } public string StatusOrder { get; set; } } public ActionResult Details(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var order = db.Orders.Include(x=>x.Statuses).Find(id); if (order == null) { return HttpNotFound(); } return View(order); }
сделал вместо Find = First(x=>x.OrderId==id)
Обсуждают сегодня