public ActionResult Index() { xmasDB db = new xmasDB(); var orders = db.GetAllRequests().ToList(); orders.ForEach(order => order.Toys = db.GetAllOrderedToys(order) as List <Toy>); Orders model = new Orders { EntityList = orders }; return(View(model)); }
public ActionResult Update(string orderId) { if (orderId != null) { xmasDB db = new xmasDB(); var order = db.GetRequest(orderId); Request model = new Request { Id = order.Id, Kid = order.Kid, Status = order.Status, Toys = db.GetAllOrderedToys(order) as List <Toy>, RequestDate = order.RequestDate }; return(View(model)); } else { return(View()); } }