public async Task <IHttpActionResult> GetStudentdIds() { IClassWorkService classWorkService = new ClassWorkService(AzureUrl); // with more time, Ioc could be done with dependency injection var ids = await classWorkService.RetrieveStudentsIds(); return(Ok(ids)); }
public async Task <IHttpActionResult> Get(DateTime from, DateTime to, int page, int pageSize, long studentId) { if (to < from || from > to) { return(BadRequest()); } IClassWorkService classWorkService = new ClassWorkService(AzureUrl); // with more time, Ioc could be done with dependency injection IModelAdapter <IEnumerable <Work>, IEnumerable <WorkDto> > adapter = new ClassWorkAdapter(); var works = await classWorkService.RetrieveClassWork(from, to); if (studentId > 0) { works = works.Where(x => x.UserId == studentId).ToArray(); } var worksTranferedObjects = adapter.Transform(works).Skip(pageSize * page).Take(pageSize); return(Ok(worksTranferedObjects)); }