Пример #1
0
        public async Task <IActionResult> Create(CandidateViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                foreach (var file in Request.Form.Files)
                {
                    var memoryStream = new MemoryStream();
                    file.CopyTo(memoryStream);
                    viewModel.CV       = memoryStream.ToArray();
                    viewModel.FileName = file.FileName;
                }

                var candidate = await _service.CreateCandidate(viewModel);

                await _service.CreateCandidateInfo(viewModel, candidate.Id);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(viewModel));
        }
Пример #2
0
        public async Task <IActionResult> Create(CandidateViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                foreach (var file in Request.Form.Files)
                {
                    var memoryStream = new MemoryStream();
                    file.CopyTo(memoryStream);
                    viewModel.CV       = memoryStream.ToArray();
                    viewModel.FileName = file.FileName;
                }

                var candidate = await _service.CreateCandidate(viewModel);

                await _service.CreateCandidateInfo(viewModel, candidate.Id);

                TempData["Candidate"] = "Thank you for applying!";

                return(RedirectToAction("Index", "Home"));
            }
            return(View(viewModel));
        }