Пример #1
0
 public async void Update(CategoryPageViewModel categoryViewModel)
 {
     _filterDefinition = categoryViewModel.FilterDefinition;
     FilterName        = _categoryNameProvider.GetName(_filterDefinition.Categories);
     Items.Clear();
     await Load();
 }
Пример #2
0
        public EventNodeViewModel(IEventListResult result, ICategoryNameProvider categoryNameProvider)
        {
            if (result == null)
            {
                return;
            }

            if (categoryNameProvider == null)
            {
                throw new ArgumentNullException("categoryNameProvider");
            }

            var image = result.Images.FirstOrDefault();

            if (image != null)
            {
                Image = image.Thumbnail.Normal;
            }

            Id          = result.Id;
            Title       = result.Title.GetNormalString();
            Description = result.Description;
            Age         = result.AgeRestriction;
            IsFree      = result.IsFree;

            if (result.Place != null)
            {
                Place = result.Place.Title.GetNormalString();
            }

            var firstCat = result.Categories.FirstOrDefault();
            var catName  = categoryNameProvider.GetName(firstCat);

            if (string.IsNullOrEmpty(catName))
            {
                Categories = firstCat;
            }
            else
            {
                Categories = catName;
            }

            var dates = result.Dates.ToArray();

            if (dates == null)
            {
                return;
            }

            Dates = GetDates(dates);
            Times = GetTimes(dates);
        }