public IActionResult AddWedding(WeddingViewModel model) { int?activeId = HttpContext.Session.GetInt32("activeUser"); if (activeId != null) { if (ModelState.IsValid) { Wedding newWedding = new Wedding { wedder_one = model.wedder_one, wedder_two = model.wedder_two, date = (DateTime)model.date, address = model.address, createdbyid = (int)activeId }; _context.Add(newWedding); _context.SaveChanges(); } return(View("NewWedding")); } return(RedirectToAction("Index", "Login")); }