public async Task <BLListResponse <WaiterDto> > GetWaitersAttendsBySubjectId(int pSubjectId) { var response = new BLListResponse <WaiterDto>(); try { } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <SubjectDto> > GetByUserIdAsync <TEntity>(int userId) where TEntity : class { var response = new BLListResponse <SubjectDto>(); try { IEnumerable <Subject> subjResult = new List <Subject>(); IEntity entitiesResult; if (typeof(TEntity).BaseType == typeof(Student)) { entitiesResult = await _uow.GetRepository <Student>().GetByExpressionAsync(sb => sb.ApplicationUserId == userId); if (entitiesResult != null) { subjResult = await _uow.GetRepository <Subject>().AllAsync(s => s.StudentStates.Any(ss => ss.StudentId == entitiesResult.Id), null, x => x.Include(s => s.Attends), x => x.Include(s => s.Exams)); response.Data = _mapper.MapEntity(subjResult); } } else if (typeof(TEntity).BaseType == typeof(Teacher)) { entitiesResult = await _uow.GetRepository <Teacher>().GetByExpressionAsync(sb => sb.ApplicationUserId == userId); if (entitiesResult != null) { subjResult = await _uow.GetRepository <Subject>().AllAsync(s => s.SubjectAssingments.Any(sa => sa.TeacherId == entitiesResult.Id), null, x => x.Include(s => s.SubjectAssingments).ThenInclude(sa => sa.Class), x => x.Include(s => s.SubjectAssingments).ThenInclude(sa => sa.ClassRoom)); response.Data = _mapper.MapEntity(subjResult); } } else { throw new ArgumentException("Only Student and Teacher has subject assosiated."); } } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <SubjectDto> > GetAllAsync() { var response = new BLListResponse <SubjectDto>(); try { var entitiesResult = await _uow.GetRepository <Subject>().AllAsync(null, null, null); response.Data = _mapper.MapEntity(entitiesResult); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <string> > GetAllSocialProvidersAsync() { var response = new BLListResponse <string>(); try { var providers = await _schemeProvider.GetAllSchemesAsync(); response.Data = providers.Select(p => p.DisplayName).Where(n => !string.IsNullOrEmpty(n)); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <GradeDto> > GetAllAsync() { var response = new BLListResponse <GradeDto>(); try { var entity = await _uow.GetRepository <Grade>().AllAsync(null, o => o.OrderBy(g => g.Id), null); response.Data = _mapper.MapEntity(entity); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <TableDto> > GetAllByTrackId(Guid trackId) { var response = new BLListResponse <TableDto>(); try { var entityResp = await _uow.GetEfRepository <Table>().AllAsync(t => t.BoundedMapId == trackId, null, null); response.Data = _mapper.MapFromEntity(entityResp); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <ClassDto> > GetClassesByGradeId(int gradeId) { var response = new BLListResponse <ClassDto>(); try { var entity = await _uow.GetRepository <Class>().AllAsync(c => c.GradeId == gradeId, null, null); response.Data = _mapper.MapEntity(entity); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <RoleDto> > GetAllRolesAsync() { var response = new BLListResponse <RoleDto>(); try { var result = await _uow.Roles.GetAllAsync(); response.Data = _mapper.MapEntity <ApplicationRole, RoleDto>(result); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <UserDto> > GetAllUsersAsync() { var response = new BLListResponse <UserDto>(); try { var resul = await _uow.Users.GetAllAsync(); response.Data = _mapper.MapEntity <ApplicationUser, UserDto>(resul); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }
public async Task <BLListResponse <StudentDto> > GetStudentsAttendsBySubjectId(int pSubjectId) { var response = new BLListResponse <StudentDto>(); try { var entityReult = await _uow.GetRepository <Student>() .AllAsync(s => s.StudentStates.Any(ss => ss.SubjectId == pSubjectId), null, x => x.Include(s => s.ApplicationUser), x => x.Include(s => s.StudentStates), x => x.Include(s => s.Attends)); response.Data = _mapper.MapEntity(entityReult); } catch (Exception ex) { HandleSVCException(response, ex); } return(response); }