static void Main(string[] args) { ProducteurService ps = new ProducteurService(); Producteur p = new Producteur { Nom = "test", prenom = "test", DateNaissance = DateTime.Now }; ps.Add(p); ps.Commit(); FilmService fs = new FilmService(); Film f = new Film { Titre = "film1", Description = "Test", // DateProd = DateTime.Now, DateProd = new DateTime(2016, 1, 1, 12, 00, 00), Price = 15, Genre = "Action", Evaluation = "Super", //avec validation // Genre = "ok", //Evaluation = "suoer", ImageUrl = "image", ProducteurId = 1 }; fs.Add(f); fs.Commit(); }
public ActionResult Create(Film f, HttpPostedFileBase Image) { f.ImageUrl = Image.FileName; serviceFilm.Add(f); serviceFilm.Commit(); var path = Path.Combine(Server.MapPath("~/Content/Upload/"), Image.FileName); Image.SaveAs(path); return(RedirectToAction("Index")); }
public ActionResult Create(Models.Film filmVM, HttpPostedFileBase Image) { Domaine.Film film = new Domaine.Film(); film.Titre = filmVM.Titre; film.Price = filmVM.Prix; film.DateProd = filmVM.ReleaseDate; film.Description = filmVM.Description; film.Genre = filmVM.Genre; film.ImageUrl = filmVM.ImageUrl; film.ProducteurId = filmVM.ProducteurId; film.Evaluation = filmVM.Avis; film.ImageUrl = Image.FileName; serviceFilm.Add(film); serviceFilm.Commit(); var path = Path.Combine(Server.MapPath("~/Content/Upload/"), Image.FileName); Image.SaveAs(path); return(RedirectToAction("Index")); }