public IActionResult Create(PersonViewModel model) { if (ModelState.IsValid) { var grp = _repository.GetGroupsByGroupName(model.Group); var _person = new Person { FirstName = model.FirstName, LastName = model.LastName, Address = model.Address, Email = model.Email, CreatedDate = DateTime.Now, Group = grp }; _repository.AddEntity(_person); _repository.SaveAll(); ModelState.Clear(); } else { } return(RedirectToAction("Index")); }