public ActionResult EditFilm(HttpPostedFileBase file, HttpPostedFileBase banner, String reissue, String genre, String country, String content, String codeFilm, PhimViewModels fvm) { String fileName = ""; if (file != null && file.ContentLength > 0) { fileName = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/Images/"), fileName); file.SaveAs(path); } String fileNameBanner = ""; if (banner != null && banner.ContentLength > 0) { fileNameBanner = Path.GetFileName(banner.FileName); var path = Path.Combine(Server.MapPath("~/Images/"), fileNameBanner); banner.SaveAs(path); } Phim p = new Phim(); p.MaSo = Int32.Parse(codeFilm); p.DiemDanhGia = fvm.DiemDanhGia; p.NoiDung = content; p.NgayPhatHanh = DateTime.ParseExact(reissue, "MM/dd/yyyy", null); ; p.TenPhim = fvm.TenPhim; p.TinhTrang = true; p.ThoiLuong = fvm.ThoiLuong; p.DaoDien = fvm.DaoDien; p.DienVien = fvm.DienVien; if (genre != "") p.MS_TheLoai = Int32.Parse(genre); if (country != "") p.MS_NuocSX = Int32.Parse(country); p.URL_Trailer = fvm.URL_Trailer; //Nếu người dùng không upload ảnh mới thì sẽ lấy lại ảnh cũ if (fileName != "") p.HinhAnh = "/Images/" + fileName; else p.HinhAnh = (String)TempData["currentAvatar"]; if (fileNameBanner != "") p.AnhBanner = "/Images/" + fileNameBanner; else p.AnhBanner = (String)TempData["currentBanner"]; FilmService filmsv = new FilmService(); filmsv.EditFilm(p); return RedirectToAction("Index"); }