// GET: Movies public ActionResult Random() { var movie = new Vidly.Models.Movie { Id = 1, Name = "Shark" }; //ViewData["Movie"] = movie; //ViewBag.RandomMovie = movie; //return View(); //return Content(movie.Name); //return HttpNotFound(); //return new EmptyResult(); // return RedirectToAction("Index", "Home", new { page = 1, SortBy = "name" }); var customers = new List <Models.Customer> { new Models.Customer { Name = "Customer 1" }, new Models.Customer { Name = "Customer 1" } }; var viewmodel = new ViewModels.RandomMovieViewModel { Customers = customers, movies = movie }; return(View(viewmodel)); //return View(); }
// GET: Movies public ActionResult Random() { Movie movie1 = new Movie() { Name = "Shrek!" }; var customers = new List <Customer> { new Customer { Name = "Rhea" }, new Customer { Name = "Molly" } }; var viewModel = new ViewModels.RandomMovieViewModel() { movie = movie1, Customers = customers }; return(View(viewModel)); //Other possibilities //return Content("Hello! My name is Lily. (I dont want to use my real name) "); //return HttpNotFound(); //return new EmptyResult(); //return RedirectToAction("Index", "Home", new { page=1, sortBy = "n" }); }
public HomeController() { var movie = new Movie() { name = "Destructor" }; var customers = new List <Customer>() { new Customer { name = "customer 01" }, new Customer() { name = "customer 02" }, }; this.viewModel = new RandomMovieViewModel() { customers = customers, movie = movie }; }
// GET: Movies/Random public ActionResult Random() { var movie = new Movie() { Name = "Shrek!" }; var customers = new List <Customer> { new Customer { Name = "John Smith" }, new Customer { Name = "Mary Williams" } }; var viewModel = new ViewModels.RandomMovieViewModel { Movie = movie, Customers = customers }; //ViewData["Movie"] = movie; return(View(viewModel)); }
public ActionResult Details(int Id) { var Name = ""; if (Id == 1) { Name = "John Smith"; } else if (Id == 2) { Name = "Mary Williams"; } var customers = new List <Customer> { new Customer { Name = Name } }; var viewModel = new ViewModels.RandomMovieViewModel { Customers = customers }; return(View(viewModel)); }
public ViewResult Index() { var viewdata = new ViewModels.RandomMovieViewModel(); viewdata.Customers = _context.Customers.Include(c => c.MemberShipType).ToList(); return(View(viewdata)); }
// GET: Customers public ActionResult Get() { var customers = new List <Models.Customer> { new Customer { Id = 1, Name = "Customer1" }, new Customer { Id = 2, Name = "Customer2" } }; var getCustomer = new ViewModels.RandomMovieViewModel { Customer = customers }; return(View(getCustomer)); }
// GET: Movies/Random public ActionResult Random() { var movie = new Movie() { Name = "Shrek!" }; var customers = new List <Customer> { new Customer { Name = "Customer1" }, new Customer { Name = "Customer2" } }; var viewModel = new ViewModels.RandomMovieViewModel { Movie = movie, Customers = customers }; return(View(viewModel)); }