using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.Entity; using System.Web.Mvc; using Vidly.Models; using Vidly.ViewModels; namespace Vidly.Controllers { public class CustomersController : Controller { private ApplicationDbContext _context; public CustomersController() { _context = new ApplicationDbContext(); } protected override void Dispose(bool disposing) { _context.Dispose(); } // GET: Vidly public ActionResult Index() { return View(); } public ActionResult Customers() { var viewModel = new CustomersViewModel() { Customers = _context.Customers.Include(c=>c.MembershipType).ToList() }; return View(viewModel); } [Route("Customers/Details/{nr}")] public ActionResult Customer(int nr) { var customer = _context.Customers.Include(c => c.MembershipType).SingleOrDefault(c => c.Id == nr); if (customer== null) return HttpNotFound(); return View(customer); } public ActionResult Movies() { return View(); } } }