public IHttpActionResult GetDecksNeedToRepeat(string userLogin) { try { List <DeckDTO> decksNeedToRepeat = new List <DeckDTO>(); List <DeckSubscriptionDTO> deckSubscriptionDTOs = new List <DeckSubscriptionDTO>(); deckSubscriptionDTOs = userSubscriptions.GetDeckSubscriptions(userLogin).ToList(); deckSubscriptionDTOs.ForEach(deckSub => { if (quiz.GetCardsForRepeat(statistics.GetDeckStatistics(userLogin, deckSub.DeckId)).Count() > 0) { decksNeedToRepeat.Add(catalogBll.GetDeckDTO(deckSub.DeckId)); } }); return(Ok(decksNeedToRepeat)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult GetDeckByLinking(string linking) { try { DeckDTO deck = catalog.GetDeckDTO(linking); // PhotoUrlLoader.LoadDecksPhotos(deck); return(Ok(deck)); } catch (ArgumentNullException ex) { var message = $"DEck with linking = {linking} not found. {ex.Message}"; return(BadRequest(message)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }