public IActionResult AssignToken(int id) { var person = DataContext.People .Where(p => !p.IsDeleted) .FirstOrDefault(p => p.Id == id); if (person == null) { return(RedirectToAction("Index")); } AssociatePersonRequestViewModel model = GetAssociatePersonRequestModel(person); return(View(model)); }
public IActionResult AssignToken(AssociatePersonResponseViewModel model) { var person = DataContext.People.FirstOrDefault(p => p.Id == model.PersonId); if (!ModelState.IsValid) { AssociatePersonRequestViewModel requestModel = GetAssociatePersonRequestModel(person); return(View(requestModel)); } person.TokenValue = model.TokenValue; DataContext.SaveChanges(); AddSuccess("Associated", "Assigned access token to {0}", person.Name); return(RedirectToAction("Index")); }