//[ValidateAntiForgeryToken] public ActionResult CreateHuman(AddHumanViewModel model, HttpPostedFileBase photo1) { if (!ModelState.IsValid) { return(View("CreateHuman", model)); } ; string name = model.FirstName + " " + model.LastName; string path = ""; if (photo1 != null) { path = Path.Combine(Server.MapPath("~/Photos"), $"{Guid.NewGuid()}{Path.GetExtension(photo1.FileName)}"); photo1.SaveAs(path); } Human human = new Human() { Name = name, Photo1 = Path.GetFileName(path), ApplicationUserId = User.Identity.GetUserId() }; _context.Humen.Add(human); _context.SaveChanges(); return(RedirectToAction("CreateQuestion", "CreateQuestion", new { id = human.Id })); }
// GET: CreatePerson public ActionResult CreateHuman() { AddHumanViewModel addHumanViewModel = new AddHumanViewModel(); return(View(addHumanViewModel)); }