I have these two URL's I want to make available to my users:
/Account/Orders <- This would should be a grid of all orders.
/Account/Orders/132 <- This would show this particular order information.
Here are my two ActionMethods:
[Authorize]
public ActionResult Orders(int id)
{
using (var orderRepository = new EfOrderRepository())
using (var accountRepository = new EfAccountRepository())
{
OrderModel model = new OrderModel();
return View(model);
}
}
[Authorize]
public ActionResult Orders()
{
using (var orderRepository = new EfOrderRepository())
using (var accountRepository = new EfAccountRepository())
{
List<OrderModel> model = new List<OrderModel>();
return View(model);
}
}
If my Orders view is strongly typed with an OrderModel
as the model, the Orders()
action method won't work as I need to pass it an IEnumerable instead of a single object.
What do you suggest in this case? This seems like something that's easy to do, but I've had a very long (productive!) day, but I can only go so far.