public IActionResult Index() { var model = new TestInputModel { Names = new Names { FirstName = "Asen", LastName = "Geshev", }, Email = "1@1", YearsOfExperience = 7, DateOfBirth = new DateTime(1212, 12, 12), Egn = "1234567890", University = "SoftUni", AllTypes = positionsService.GetAll(), }; return(PartialView(model)); }
public async Task <IActionResult> Index(TestInputModel input) //public IActionResult Index([Bind("Names")]TestInputModel input) //public IActionResult Index([FromQuery]TestInputModel input, [FromServices]IYearsService years) //public IActionResult Index([FromQuery]TestInputModel input, [FromHeader]string accept) { if (input.CandidatType3 > 3) { ModelState.AddModelError(nameof(TestInputModel.CandidatType3), "Invalid..."); } if (!ModelState.IsValid) { //return Json(ModelState); input.AllTypes = positionsService.GetAll(); return(View(input)); } input.AllTypes = positionsService.GetAll(); var expectedFileExt = new[] { ".pdf", ".doc", ".docx", ".xls", ".xlsx" }; var ext = expectedFileExt.FirstOrDefault(x => input.CV.First().FileName.EndsWith(x)); if (ext != null) { var filePath = @$ "D:\OneDrive\Desktop\user{ext}"; using var fileStream = new FileStream(filePath, FileMode.Create); if (input.CV.First().Length > 1024 * 1024 * 10) { } await input.CV.First().CopyToAsync(fileStream); } //return Json(years.GetLastYears(5)); //return Json(accept); //return Json(input); return(Redirect("/")); }