public async Task <bool> Login(User user) { using (var con = new SqlConnection(this._connectionString)) { try { var result = _entityFrameworkDbContext.Set <User>() as IQueryable <User>; var slectUser = result.Where(x => x.Password.Equals(_helpers.Encrypt(user.Password)) && x.Username.Equals(user.Username)); return(slectUser.Count() > 0 ? true : false); } catch (Exception e) { this._logger.LogError($"Getting the data from config.AuthorizationRoles on config database failed: {e.Message}."); throw; } } }
public bool AddDefender(Defender defender) { try { _entityFrameworkDbContext.Set <Defender>().Add(defender); _entityFrameworkDbContext.SaveChanges(); return(true); } catch (Exception e) { this._logger.LogError($"Getting the data from config.AuthorizationRoles on config database failed: {e.Message}."); throw; } }
public override TAggregateRoot GetByKey(long key) { return(dbContext.Set <TAggregateRoot>().FirstOrDefault(p => p.Id == key)); }
public static bool ExistsLocal <T>(this IEntityFrameworkDbContext dbContext, T entity) where T : class { return(dbContext.Set <T>().Local.Contains(entity)); }
public static T FirstOrDefautLocal <T>(this IEntityFrameworkDbContext dbContext, Func <T, bool> predicate) where T : class { return(dbContext.Set <T>().Local.FirstOrDefault(predicate)); }
public static bool ExistsLocal <T>(this IEntityFrameworkDbContext dbContext, Func <T, bool> predicate) where T : class { return(dbContext.Set <T>().Local.Any(predicate)); }