public List <UserVM> GetAll() { var userList = con.Set <User>().AsEnumerable() .Select(x => mapper.Map <UserVM>(x)) .ToList(); return(userList); }
public virtual async Task <T> GetByIDAsync(Guid id) { try { return(await con.Set <T>().FirstOrDefaultAsync(p => p.Id == id && !p.IsDeleted)); } catch (Exception ex) { SentrySdk.CaptureException(ex); return(null); } }
public virtual async Task <int> CreateAsync(TEntity model) { if (model == null) { throw new ArgumentNullException(string.Format(ErrorDetails.EntityCannotBeNull, nameof(TEntity))); } await dbContext.Set <TEntity>().AddAsync(model); await dbContext.SaveChangesAsync(); return(model.Id); }
private bool IsGroupExistOnDatabase(Guid groupId) { bool isGroupExist = _con.Set <ChatRoom>().AsNoTracking().Any(a => a.Id == groupId); if (!isGroupExist) { SentrySdk.CaptureException(new Exception(APIStatusCode.ERR04006)); } return(isGroupExist); }