Ejemplo n.º 1
0
        public async Task <SheetDTO> GetBySubject(int month, int year)
        {
            Sheet theSheet = await this._sheetRetrievalService.GetBySubjectAsync(month, year, this.OwnerId);

            PreviousSheetVisitMarker marker = await this._sheetLastVisitedMarkerService.GetAndUpdateAsync(theSheet, this.User.Identity.GetUserId());

            SheetDTO dto = this._mappingEngine.Map <Sheet, SheetDTO>(theSheet, opts => opts.SetPreviousSheetVisitMarker(marker));

            Array.Sort(dto.Entries, SortOrderComparer <SheetEntry> .Instance);
            return(dto);
        }
Ejemplo n.º 2
0
        public async Task <SheetDTO> GetById(int id)
        {
            Sheet sheet = await this._sheetRepository.FindByIdInclude(id).FirstOrDefaultAsync().EnsureNotNull();

            sheet.Entries = new List <Models.Domain.SheetEntry>(this._sheetRepository.GetOfSheet(sheet));

            PreviousSheetVisitMarker marker = await this._sheetLastVisitedMarkerService.GetAndUpdateAsync(sheet, this.User.Identity.GetUserId());

            this.EntityOwnerService.EnsureOwner(sheet, this.OwnerId);
            SheetDTO dto = this._mappingEngine.Map <Sheet, SheetDTO>(sheet, m => m.SetPreviousSheetVisitMarker(marker));

            Array.Sort(dto.Entries, SortOrderComparer <SheetEntry> .Instance);

            return(dto);
        }