Example #1
0
        protected virtual void SetSettingsFromJson(JObject json)
        {
            Downloaded = (bool?)json["Downloaded"];
            var genres = (IEnumerable)json["Genres"];

            genres.OfType <object>().ToList().ForEach(g => {
                var genre = Genres.Selections.FirstOrDefault(gg => gg.Item == g.ToString());
                if (genre != null)
                {
                    genre.IsSelected = true;
                }
            });
            NotFound         = (bool?)json["NotFound"];
            NotWatched       = (bool?)json["NotWatched"];
            VoteCountMax     = (int?)json["VoteCountMax"];
            VoteCountMin     = (int?)json["VoteCountMin"];
            PageSize         = (int)json["PageSize"];
            Query            = (string)json["Query"];
            RatingMax        = (float?)json["RatingMax"];
            RatingMin        = (float?)json["RatingMin"];
            ReleaseYearEnd   = (int?)json["ReleaseYearEnd"];
            ReleaseYearStart = (int?)json["ReleaseYearStart"];
            RuntimeMax       = (int?)json["RuntimeMax"];
            RuntimeMin       = (int?)json["RuntimeMin"];
            SelectedOrder    = OrderList.First(o => o.Order.Value == (decimal)json["SelectedOrderValue"]);
            var isDescending = (bool?)json["SelectedOrderDescending"];

            if (isDescending.HasValue)
            {
                SelectedOrder.IsDescending = isDescending.Value;
            }
            SubtitleDownloaded = (bool?)json["SubtitleDownloaded"];
            SubtitleNotFound   = (bool?)json["SubtitleNotFound"];
        }
        public Task <bool> Delete(int orderId)
        {
            //soft delete by setting cancelled property
            bool found = OrderList.Any(o => (o.Id == orderId) && (!o.Cancelled));

            if (found)
            {
                OrderList.First(o => o.Id == orderId).Cancelled = true;
            }
            return(Task <bool> .FromResult(found));
        }