/// <summary> /// saves the media to Disk /// </summary> private static void AddMedia(Report report, HttpPostedFile photo1, HttpPostedFile photo2, HttpPostedFile photo3, HttpPostedFile video, HttpPostedFile audio) { if (photo1 != null) { FileInfo fileInfo = new FileInfo(photo1.FileName); report.AddMedia(new Photo { Url = "~/Content/uploads/" + DateTime.Now.Ticks + "1_" + fileInfo.Name, File = photo1 }); } else { report.AddMedia(null); } if (photo2 != null) { FileInfo fileInfo = new FileInfo(photo2.FileName); report.AddMedia(new Photo { Url = "~/Content/uploads/" + DateTime.Now.Ticks + "2_" + fileInfo.Name, File = photo2 }); } else { report.AddMedia(null); } if (photo3 != null) { FileInfo fileInfo = new FileInfo(photo3.FileName); report.AddMedia(new Photo { Url = "~/Content/uploads/" + DateTime.Now.Ticks + "3_" + fileInfo.Name, File = photo3 }); } else { report.AddMedia(null); } if (video != null) { FileInfo fileInfo = new FileInfo(video.FileName); report.AddMedia(new Video { Url = "~/Content/uploads/" + DateTime.Now.Ticks + "4_" + fileInfo.Name, File = video }); } else { report.AddMedia(null); } if (audio != null) { FileInfo fileInfo = new FileInfo(audio.FileName); report.AddMedia(new Audio { Url = "~/Content/uploads/" + DateTime.Now.Ticks + "5_" + fileInfo.Name, File = audio }); } else { report.AddMedia(null); } }