public bool SaveJwt(string token, Guid uId) { var claimJwt = new ClaimJwt { Jwt = token, UserId = uId }; try { var claimJwtExists = _ctx.ClaimJwts.FirstOrDefault(x => x.UserId == uId); if (claimJwtExists == null) { _ctx.Add(claimJwt); } else { claimJwtExists.UserId = uId; claimJwtExists.Jwt = token; _ctx.Entry(claimJwtExists).State = Microsoft.EntityFrameworkCore.EntityState.Modified; } _ctx.SaveChanges(); } catch (Exception e) { var error = e; throw; } return(true); }
public void Create(Role role) { _prContext.Entry(role).State = Microsoft.EntityFrameworkCore.EntityState.Added; _prContext.SaveChanges(); }
public User Update(User user) { _ctx.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _ctx.SaveChanges(); return(user); }