public IActionResult Edit(ClientModel model) { Client client; if (model.Id == 0) { model.SetDefaultValues(); client = new Client(); _configurationDbContext.Clients.Add(client); } else { model.ConvertItemsToList(); client = _configurationDbContext.Clients .Include(x => x.AllowedGrantTypes) .Include(x => x.RedirectUris) .Include(x => x.PostLogoutRedirectUris) .Include(x => x.AllowedScopes) .Include(x => x.ClientSecrets) .Include(x => x.Claims) .Include(x => x.IdentityProviderRestrictions) .Include(x => x.AllowedCorsOrigins) .Include(x => x.Properties) .Where(x => x.Id == model.Id) .FirstOrDefault(); client.Updated = DateTime.Now; } model.UpdateEntity(client); _configurationDbContext.SaveChanges(); return(RedirectToAction(nameof(Edit), new { id = client.Id })); }
public IActionResult Clone(ClientModel model) { Client client = new Client(); model.ConvertItemsToList(); model.UpdateEntity(client); _configurationDbContext.Clients.Add(client); _configurationDbContext.SaveChanges(); return(RedirectToAction(nameof(Edit), new { id = client.Id })); }