private void RemoveOldPicksOfTheWeek(List <PickOfTheWeek> oldPicksOfTheWeek) { var picksOfTheWeek = _pickOfTheWeekService .AsQueryable() .ToList(); foreach (var pick in picksOfTheWeek) { oldPicksOfTheWeek.Add(pick); _pickOfTheWeekService.RemovePickOfTheWeek(pick); } }
public ActionResult <IEnumerable <BookDto> > GetPicksOfTheWeek() { List <BookDto> picksOfTheDay = new List <BookDto>(); var bookIds = _pickOfTheWeekService.AsQueryable().Select(x => x.BookId).ToList(); foreach (var id in bookIds) { var book = _bookService .AsQueryable() .Include(x => x.Genre) .Include(x => x.Publisher) .Where(x => x.Id == id) .FirstOrDefault(); picksOfTheDay.Add(MapToBookDto(book)); } return(picksOfTheDay); }