public ActionResult UploadFile(DisciplineUploadFileModel discipline) { for (int i = 0; i < Request.Files.Count; i++) { HttpPostedFileBase arquivo = Request.Files[i]; if (arquivo.ContentLength > 0) { if (arquivo.ContentType.Equals("application/pdf")) { string fileName = discipline.CodeDiscipline + ".pdf"; UploadFileUtil.FTPUpload(fileName, arquivo); } } } if (discipline.CourseOptionRoute != null) { string action = CourseController.GetRoute((int)discipline.CourseOptionRoute); if (discipline.CourseOptionRoute != (int)CourseOptionRouteEnum.INDIVIDUAL) { return(RedirectToAction(action, "Course").Success("Arquivo enviado com sucesso")); } return(RedirectToAction(action, "Course", new { code = discipline.CodeCourse }).Success("Arquivo enviado com sucesso")); } else if (discipline.CodeTeacher != null) { return(RedirectToAction("AllTeachers", "Teacher").Success("Arquivo enviado com sucesso")); } else { return(RedirectToAction("AllDisciplines", "Discipline").Success("Arquivo enviado com sucesso")); } }
public ActionResult UploadFile(string codeDiscipline, string disciplineName, int?courseOption, string codeCourse, int?option, string codeTeacher) { ViewBag.Url = Url.Action("AllDisciplines"); DisciplineUploadFileModel course = new DisciplineUploadFileModel() { CodeDiscipline = codeDiscipline, NameDiscipline = disciplineName, CodeCourse = codeCourse, CourseOptionRoute = courseOption, OptionRoute = option, CodeTeacher = codeTeacher }; return(View(course)); }