0
동영상에 행을 추가하고 동영상의 실제 파일 이름과 동일한 ID를 사용하고 싶습니다. 그래서 나는 파일 이름없이 행을 추가 한 다음, 내가 얻은 ID를 사용하고 그 파일 이름으로 행을 업데이트해야한다. 나는 지금 어떻게해야하는지 확신하고있다.이미 존재하는 행을 편집하는 방법
public ActionResult UpVideo(Report Report, string VideoName, HttpPostedFileBase file)
{
Video v = new Video();
v.Name = VideoName;
v.Report = Report;
db.Videos.Add(v);
var filename = v.ID + "." + Path.GetExtension(file.FileName);
var path = Path.Combine(Server.MapPath("~/App_Data/video_uploads"), filename);
file.SaveAs(path);
v.FileName = filename;
//** update Row here with filename
db.SaveChanges();
//** redirect back to Report Details (need to figure out how do do this too)
return RedirectToAction(Report);
}
v가 참조 인 것을 잊어 버렸습니다. 따라서 동영상에 추가 한 후에도 수정할 수 있습니다. 파일 확장자를 저장하는 것에 대한 제안 사항입니다. 내가 할게. 완벽하게 이해합니다. 감사. – TheColonel26