public async Task <IActionResult> UploadFileSupervisor() { var model = new ReportModel(); var UserSession = HttpContext.Session.Get <UserModel>("UserSesion"); var Assign = HttpContext.Session.Get <AssignmentModel>("ReporModelSupervisor"); model = Assign.Report; modelResult = Assign.Report; try { if (!Request.HasFormContentType) { return(Json(new { content = "Error" })); } foreach (var file in Request.Form.Files) { byte[] dataSupervisor; using (var br = new BinaryReader(file.OpenReadStream())) dataSupervisor = br.ReadBytes((int)file.OpenReadStream().Length); model.Files = new List <FileModel>(); string[] nameArr = file.FileName.Trim().Split("."); var fileModel = new FileModel(); fileModel.Id = Guid.NewGuid().ToString(); fileModel.IdRef = model.Id; fileModel.Name = file.FileName.Trim().Replace(" ", ""); fileModel.Ext = nameArr[1]; fileModel.FileData = dataSupervisor; fileModel.CreatedBy = UserSession.Name; model.Files.Add(fileModel); } ClientResponse clientResponse = null; clientResponse = await _assignmentService.AddFileToReportSupervisor(model); modelResult.Files.AddRange(model.Files); if (clientResponse == null || clientResponse.Status != System.Net.HttpStatusCode.OK) { return(Json(new { content = "Error" })); } } catch (Exception) { } return(PartialView("_FileListSupervisor", modelResult)); }