Пример #1
0
        public async Task <Result <GradeSheets> > GetGradeSheets(string sessionId, string semester)
        {
            this.logger.LogDebug("GetGradeSheets");
            try
            {
                var res = await client.GetGradeSheets(sessionId, semester);

                var isAuthorized = CheckAuthorization(res);
                if (!isAuthorized)
                {
                    return(Result <GradeSheets> .Failure(new UnauthorizedAccessException()));
                }
                return(Result <GradeSheets> .Success(
                           converter.ParseGradeSheets(res) ??
                           new GradeSheets("Нет", Array.Empty <string>(), Array.Empty <GradeSheet>())
                           ));
            }
            catch (Exception e)
            {
                this.logger.LogError(e, "GetGradeSheets");
                return(Result <GradeSheets> .Failure(e));
            }
        }