public ActionResult FilmCreate() { Film film = new Film(); film.Title = "a new film"; film.YearMade = 0; film.Link = "xx"; film.Imagefile = "xx"; film.Resources = "zz"; film.Synopsis = "xx"; dbcon.Open(); int intresult = Film.CUFilm(dbcon, "create", film); dbcon.Close(); return(RedirectToAction("FilmList", "Admin")); }
public ActionResult FilmEdit(FormCollection fc, HttpPostedFileBase UploadFile) { Film film = new Models.Film(); TryUpdateModel <Film>(film, fc); if (UploadFile != null) { var fileName = Path.GetFileName(UploadFile.FileName); var filePath = Server.MapPath("/Content/Images/Films"); string savedFileName = Path.Combine(filePath, fileName); UploadFile.SaveAs(savedFileName); film.Imagefile = fileName; } if (ModelState.IsValid) { dbcon.Open(); int intresult = Film.CUFilm(dbcon, "update", film); FilmCategory.UpdateCategories(dbcon, fc); dbcon.Close(); } return(RedirectToAction("FilmList", "Admin")); }