public async Task <IActionResult> Create(MainPage mainpage, IFormFile file) { if (ModelState.IsValid) { if (file != null) { mainpage.Videocode = await _upload.Create(_env.WebRootPath, file, "File", "video", mainpage.Videocode); } var result = await _context.AddAsync(mainpage); await _context.SaveChangesAsync(); } return(RedirectToAction("Index")); }