Bzs.Server.ServerService.LessonServerService.GetLessonsOfWeek C# (CSharp) Method

GetLessonsOfWeek() public method

Returns the lessons of the week.
public GetLessonsOfWeek ( System.Guid accountId ) : List
accountId System.Guid The account identifier.
return List
        public List<LessonEditDto> GetLessonsOfWeek(Guid accountId)
        {
            List<LessonEditDto> data = new List<LessonEditDto>();
            using (BzsEntityContainer ctx = this.CreateContainer())
            {
                IQueryable<LessonEntity> entities = ctx.LessonSet.Where(f => f.AccountId == accountId);
                foreach (LessonEntity entity in entities)
                {
                    LessonEditDto item = this.FillLessonEditDto(new LessonEditDto(), entity);
                    data.Add(item);
                }
            }

            return data;
        }

Usage Example

        /// <summary>
        /// Returns the lessons of a week.
        /// </summary>
        /// <returns>The lessons.</returns>
        public List<LessonEditDto> GetLessonOfWeek()
        {
            this.SetResponseHeaderCacheExpiration();

            AccountPassword credentials = this.GetCredentialsFromRequest();
            AccountServerService accountService = new AccountServerService();
            Guid accountId = accountService.GetAccountId(credentials.Account);

            LessonServerService service = new LessonServerService();
            return service.GetLessonsOfWeek(accountId);
        }