Beispiel #1
0
        public IActionResult GetPeriods(Guid employeeId, Guid schoolId, DateTime startDateTime, DateTime endDateTime)
        {
            IContainer container = IocService.BeginRequest();
            ServiceResult <List <PeriodDto> > result = container.GetInstance <IPeriodService>().GetPeriods(employeeId, schoolId, startDateTime, endDateTime);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }
Beispiel #2
0
        public IActionResult RemoveHomework(Guid homeworkId)
        {
            IContainer container = IocService.BeginRequest();
            ServiceResult <HomeworkDto> result = container.GetInstance <IHomeworkService>().RemoveHomework(homeworkId);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }
Beispiel #3
0
        public IActionResult UpdateHomework([FromBody] HomeworkRequest homeworkRequest)
        {
            IContainer container = IocService.BeginRequest();
            ServiceResult <HomeworkDto> result = container.GetInstance <IHomeworkService>().UpdateHomework(homeworkRequest);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }
Beispiel #4
0
        public IActionResult UpdateUser([FromBody] UserRequest userRequest)
        {
            IContainer           container = IocService.BeginRequest();
            ServiceResult <Guid> result    = container.GetInstance <IUserService>().UpdateUser(userRequest);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }
Beispiel #5
0
        public IActionResult GetUserSession(string username)
        {
            IContainer container = IocService.BeginRequest();
            ServiceResult <UserSessionDto> result = container.GetInstance <IUserService>().GetUserSession(username);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }
Beispiel #6
0
        public IActionResult GetAlexaUsersForDevice(string deviceId)
        {
            IContainer container = IocService.BeginRequest();
            ServiceResult <List <AlexaUserDto> > result = container.GetInstance <IUserService>().GetAlexaUsersForDevice(deviceId);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }
Beispiel #7
0
        public IActionResult GetPastHomework(Guid schoolId, Guid employeeId, Guid subjectId, Guid studentGroupId)
        {
            IContainer container = IocService.BeginRequest();

            Expression <Func <HomeworkDto, object> >[] includes = new Expression <Func <HomeworkDto, object> >[]
            {
                include => include.Students
            };
            ServiceResult <List <HomeworkDto> > result = container.GetInstance <IHomeworkService>().GetPastHomework(schoolId, employeeId, subjectId, studentGroupId, includes);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }
Beispiel #8
0
        public IActionResult GetHomeworkForLesson(Guid lessonId)
        {
            IContainer container = IocService.BeginRequest();

            Expression <Func <HomeworkDto, object> >[] includes = new Expression <Func <HomeworkDto, object> >[]
            {
                include => include.Resources
            };
            ServiceResult <List <HomeworkDto> > result = container.GetInstance <IHomeworkService>().GetHomeworkForLesson(lessonId, includes);

            IocService.EndRequest(container);

            if (result.ResultType == ResultType.Error)
            {
                return(BadRequest(result.Message));
            }

            return(Ok(result));
        }