public ActionResult UploadFile(CourseUploadFileModel course) { for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase file = Request.Files[i]; if (file.ContentLength > 0) { if (file.ContentType.Equals("application/pdf")) { var type = Request.Files.Keys[i]; string fileName = GetFileName(type); fileName = fileName + "_" + course.CodeCourse + ".pdf"; UploadFileUtil.FTPUpload(fileName, file); } } } string action = GetRoute(course.OptionRoute); if (course.OptionRoute != (int)CourseOptionRouteEnum.INDIVIDUAL) { return(RedirectToAction(action, "Course")); } return(RedirectToAction(action, "Course", new { code = course.CodeCourse }).Success("Arquivo enviado com sucesso")); }
public ActionResult UploadFile(string codeCourse, string courseName, int option, int type) { ViewBag.Url = Url.Action(GetRoute(option <= 3 ? option : 1)); CourseUploadFileModel course = new CourseUploadFileModel() { CodeCourse = codeCourse, NameCourse = courseName, OptionRoute = option, Type = type }; if (type == (int)TypeCourseEnum.POSTGRADUATE) { int index = course.FileList.FindIndex(e => e.IdType == (int)TypeCourseFileEnum.ATO); course.FileList.RemoveAt(index); } return(View(course)); }