Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MoviesController : Controller
- {
- PAPEntities db = new PAPEntities();
- public ActionResult Index()
- {
- MovieViewModel[] movies = db.MoviesData.Select(movie => new MovieViewModel
- {
- MovieID = movie.MovieID,
- MovieName = movie.MovieName,
- MovieDescription = movie.MovieDescription,
- MovieCategory = movie.MovieCategory,
- MovieYear = movie.MovieYear
- }).ToArray();
- return View(movies);
- }
- public ActionResult Details(int Id = 1)
- {
- MovieViewModel MovieVM = db.MoviesData.Find(Id);
- return View(MovieVM);
- }
- public class MovieViewModel
- {
- public int MovieID { get; set; }
- public string MovieName { get; set; }
- public string MovieDescription { get; set; }
- public string MovieCategory { get; set; }
- public string MovieYear { get; set; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement