예제 #1
0
 public ActionResult DeleteOk(int id)
 {
     var context = new MovieDbEntities();
     var movie = context.Movies.Where(x => x.Id == id).FirstOrDefault();
     context.Movies.Remove(movie);
     context.SaveChanges();
     return RedirectToAction("Index");
 }
예제 #2
0
 public ActionResult EditOk(int id, MovieFullModel model)
 {
     var context = new MovieDbEntities();
     var movie = context.Movies.Where(x => x.Id == id).FirstOrDefault();
     movie.Director = model.Director;
     movie.Title = model.MovieTitle;
     movie.Year = model.Year;
     movie.MaleRoleName = model.MaleRoleName;
     movie.MaleRoleAge = model.MaleRoleAge;
     movie.FemaleRoleName = model.FemaleRoleName;
     movie.FemaleRoleAge = model.FemaleRoleAge;
     movie.Studio = model.Studio;
     movie.StudioAddress = model.StudioAddress;
     context.SaveChanges();
     return RedirectToAction("Detail", new { id = id });
 }
예제 #3
0
        public ActionResult CreateOk(MovieFullModel model)
        {
            Movy movie = new Movy()
            {
                Director = model.Director,
                Title = model.MovieTitle,
                Year = model.Year,
                MaleRoleName = model.MaleRoleName,
                MaleRoleAge = model.MaleRoleAge,
                FemaleRoleName = model.FemaleRoleName,
                FemaleRoleAge = model.FemaleRoleAge,
                Studio = model.Studio,
                StudioAddress = model.StudioAddress
            };

            var context = new MovieDbEntities();
            context.Movies.Add(movie);
            context.SaveChanges();
            return RedirectToAction("Index");
        }
예제 #4
0
 public ActionResult Index()
 {
     var context = new MovieDbEntities();
     var movies = context.Movies.Select(MovieModel.FromMovie).ToList();
     return View(movies);
 }
예제 #5
0
 public ActionResult Edit(int id)
 {
     var context = new MovieDbEntities();
     var movie = context.Movies.Where(x => x.Id == id).Select(MovieFullModel.FromMovie).FirstOrDefault();
     return PartialView("_Edit", movie);
 }
예제 #6
0
 public ActionResult Detail(int id)
 {
     var context = new MovieDbEntities();
     var movie = context.Movies.Where(x => x.Id == id).Select(MovieFullModel.FromMovie).FirstOrDefault();
     return View(movie);
 }