public async Task <ActionResult <ICollection <User> > > CreatePortfolio([FromForm] UserDto dto) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); dto.UserId = userId; userId = dto.UserId; if (dto.CV.Length > 0) { Stream st = dto.CV.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.PesronalCV = br.ReadBytes((int)dto.CV.Length); } } if (dto.PersonalImage.Length > 0) { Stream st = dto.PersonalImage.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.PersonalImg = br.ReadBytes((int)dto.PersonalImage.Length); } } if (dto.ProjectDto[0].ProjectImage.Length > 0) { Stream st = dto.ProjectDto[0].ProjectImage.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.ProjectDto[0].ProjectImg = br.ReadBytes((int)dto.ProjectDto[0].ProjectImage.Length); } } if (dto.ProjectDto[1].ProjectImage.Length > 0) { Stream st = dto.ProjectDto[1].ProjectImage.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.ProjectDto[1].ProjectImg = br.ReadBytes((int)dto.ProjectDto[1].ProjectImage.Length); } } if (dto.ProjectDto[2].ProjectImage.Length > 0) { Stream st = dto.ProjectDto[2].ProjectImage.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.ProjectDto[2].ProjectImg = br.ReadBytes((int)dto.ProjectDto[2].ProjectImage.Length); } } if (dto.ProjectDto[0].ProjectPDF.Length > 0) { Stream st = dto.ProjectDto[0].ProjectPDF.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.ProjectDto[0].Projectpdf = br.ReadBytes((int)dto.ProjectDto[0].ProjectPDF.Length); } } if (dto.ProjectDto[1].ProjectPDF.Length > 0) { Stream st = dto.ProjectDto[1].ProjectPDF.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.ProjectDto[1].Projectpdf = br.ReadBytes((int)dto.ProjectDto[1].ProjectPDF.Length); } } if (dto.ProjectDto[2].ProjectPDF.Length > 0) { Stream st = dto.ProjectDto[2].ProjectPDF.OpenReadStream(); using (BinaryReader br = new BinaryReader(st)) { dto.ProjectDto[2].Projectpdf = br.ReadBytes((int)dto.ProjectDto[2].ProjectPDF.Length); } } await userRepositories.GetAllUsers(dto); return(RedirectToAction("ShowPortfolio", "Show")); }