示例#1
0
 public static void Saver(Film add)
 {
     using (var db = new DBmovieContext())
     {
         db.Films.Add(add);
         db.SaveChanges();
     }
 }
示例#2
0
        public ActionResult AddFilm(Film film)
        {
            if (Request.Files.Count > 0)
            {
                var file = Request.Files[0];

                if (file != null && file.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(file.FileName);
                    film.Nameimage = fileName;
                    var path = Path.Combine(Server.MapPath("~/Content/image/"), fileName);
                    file.SaveAs(path);
                }
            }

            Addedfilm.Saver(film);
            return RedirectToAction("Films");
        }
示例#3
0
        public List<Film> GetAllFilmsOld()
        {
            List<Film> films = new List<Film>();

            var film = new Film
            {
                Name = "The man from U.N.C.L.E",
                genres = Genres.Action,
                Created = new DateTime(2007, 5, 18)
            };

            films.Add(film);

            film = new Film
            {

                Created = new DateTime(2009, 2, 15),
                genres = Genres.Drama,
                Name = "The Ant-Man"
            };
            films.Add(film);

            return films;
        }