// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IdentityDbContext dbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // temp: to generate data into the test db dbContext.Database.EnsureCreated(); // forcefully reload the social user and social domain's relationships dbContext.Entry(dbContext.Users.Find(SocialDomainAdminId)).Collection(x => x.Domains).Load(); dbContext.Entry(dbContext.Domains.Find(SocialDomainId)).Collection(x => x.Users).Load(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapGrpcService <AccountService>(); endpoints.MapGrpcService <AuthenticationService>(); endpoints.MapGrpcService <DomainsService>(); endpoints.MapGrpcService <ProjectsService>(); endpoints.MapGrpcService <UsersService>(); endpoints.MapGrpcService <InteropService>(); endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909"); }); }); }
public async Task <bool> Add(TEntity entity) { _context.Entry(entity).State = EntityState.Added; int changes = await _context.SaveChangesAsync(); return(changes > 0); }
public bool Add(TEntity entity) { _context.Entry(entity).State = EntityState.Added; int changes = _context.SaveChanges(); return(changes > 0); }
public void Update(TEntity entity) { var entry = _context.Entry(entity); if (entry.State == EntityState.Detached) { Set.Attach(entity); entry = _context.Entry(entity); } entry.State = EntityState.Modified; }
public async Task <IActionResult> DeleteApp(string id) { _identityContext.Entry(_identityContext.UserApplications.Single(x => x.AppId == id && x.UserId == User.FindFirstValue(ClaimTypes.NameIdentifier))).State = EntityState.Deleted; _identityContext.Entry(_identityContext.Applications.Single(x => x.Id == id)).State = EntityState.Deleted; await _identityContext.SaveChangesAsync(); return(RedirectToAction("Manage")); }
public CommonTest() { InitializeVariables(); var options = new DbContextOptionsBuilder <IdentityDbContext>() .UseSqlite("DataSource=:memory:") .Options; db = new IdentityDbContext(options); FillData(db); db.Entry(db.Users.Find(SocialDomainAdminId)).Collection(x => x.Domains).Load(); db.Entry(db.Domains.Find(SocialDomainId)).Collection(x => x.Users).Load(); }
public ActionResult Edit(Genre genre) { if (ModelState.IsValid) { db.Entry(genre).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(genre)); }
public void Update(T entity) { if (entity != null) { DbSet.Attach(entity); Context.Entry(entity).State = EntityState.Modified; } else { throw new Exception(); } }
public ActionResult Edit(Microsoft.AspNet.Identity.EntityFramework.IdentityRole role) { try { IdentityDbContext context = new IdentityDbContext(); context.Entry(role).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void Update(T item) { try { if (item == null) { throw new ArgumentNullException("item"); } _context.Entry(item).State = EntityState.Modified; } catch (Exception ex) { throw ex; } }
public ActionResult Edit(IdentityUser applicationUser, string[] roleId) { if (ModelState.IsValid) { db.Entry(applicationUser).State = EntityState.Modified; db.SaveChanges(); var rolesForUser = UserManager.GetRoles(applicationUser.Id); foreach (var item in rolesForUser) { UserManager.RemoveFromRole(applicationUser.Id, item.ToString()); } if (roleId != null) { foreach (var item in roleId) { UserManager.AddToRole(applicationUser.Id, item.ToString()); } } return(RedirectToAction("Index")); } return(View(applicationUser)); }
public void Update(UserSession session) { _identityDbContext.Entry(session).State = EntityState.Modified; }
public void Update(OneTimeSecuredOperation operation) { _identityDbContext.Entry(operation).State = EntityState.Modified; }
public virtual bool Update(T entity) { db.Set <T>().Attach(entity); db.Entry(entity).State = EntityState.Modified; return(db.SaveChanges() > 0); }
public void Update(TEntity entity) { Context.Entry(entity).State = EntityState.Modified; }
public void EditUser(User user) { _identityDbContext.Entry(user).State = EntityState.Modified; }
private Domain.Entities.User LoadUser(UserDomainAssignment assignment) { dbContext.Entry(assignment).Reference(x => x.User).Load(); return(assignment.User); }