// GET: Clients/Delete/5 public async Task <IActionResult> Delete(int id) { var physicalClients = await PhysicalPerson.GetAll(); var legalClients = await LegalRepository.GetAll(); var client = await Repository.GetById(id : id); if (client == null) { return(NotFound()); } var user = await _userManager.FindByNameAsync(client.Login); HttpContext.Session.Set <string>("IdIdentity", user.Id); if (client.PhysicalPerson != null) { return(View("DeletePhysicalPerson", new PhysicalPersonViewModel { Client = client, PhysicalPerson = client.PhysicalPerson })); } else { return(View("DeleteLegalPerson", new LegalPersonViewModel { Client = client, LegalPerson = client.LegalPerson })); } }
// GET: Clients public async Task <IActionResult> Index() { var clients = await Repository.GetAll(); var physicalClients = await PhysicalPerson.GetAll(); var legalClients = await LegalRepository.GetAll(); return(View(model: clients)); }