Пример #1
0
        protected async Task<TrackingCategory> findOrCreateTC(string OptionName, string TCName)
        {
            trackingCat = (await Api.TrackingCategories.GetAllAsync()).FirstOrDefault();
            if (trackingCat == null || trackingCat.Options.FirstOrDefault() == null)
            {
                var option1 = new Option()
                {
                    Id = Guid.Empty,
                    Name = OptionName,
                    Status = TrackingOptionStatus.Active
                };


                trackingCat = await Api.TrackingCategories.CreateAsync(new TrackingCategory()
                {
                    Name = TCName,
                    Status = TrackingCategoryStatus.Active
                });


                await (await Api.TrackingCategories.GetOptionsByIDAsync(trackingCat.Id)).AddAsync(option1);

                trackingCat = await Api.TrackingCategories.GetByIDAsync(trackingCat.Id);
                wasTCCreated = true;
            }
            return trackingCat;
        }
Пример #2
0
        protected TrackingCategory findOrCreateTC(string OptionName, string TCName)
        {
            trackingCat = Api.TrackingCategories.GetAll().FirstOrDefault();
            if (trackingCat == null || trackingCat.Options.FirstOrDefault() == null)
            {
                var option1 = new Option()
                {
                    Id = Guid.Empty,
                    Name = OptionName,
                    Status = TrackingOptionStatus.Active
                };


                trackingCat = Api.TrackingCategories.Create(new TrackingCategory()
                {
                    Name = TCName,
                    Status = TrackingCategoryStatus.Active
                });


                Api.TrackingCategories[trackingCat.Id].Add(option1);

                trackingCat = Api.TrackingCategories.GetByID(trackingCat.Id);
                wasTCCreated = true;
            }
            return trackingCat;
        }