public static App ToApp(this AppPlatformSpecificationDataContract appPlatformSpecification)
 {
     return(new App()
     {
         Id = appPlatformSpecification.AppId,
         CpuArchitectureFlags = appPlatformSpecification.CpuArchitectureFlags
     });
 }
        public static AppPlatformSpecificationDataContract ToAppPlatformSpecificationDataContract(this App app)
        {
            var appPlatformSpecification = new AppPlatformSpecificationDataContract()
            {
                AppId = app.Id,
                CpuArchitectureFlags = app.CpuArchitectureFlags
            };

            return(appPlatformSpecification);
        }
 public static AppPlatformSpecification ToAppPlatformSpecification(
     this AppPlatformSpecificationDataContract appPlatformSpecificationDataContract)
 {
     return(new AppPlatformSpecification()
     {
         AppId = appPlatformSpecificationDataContract.AppId,
         CpuArchitectureFlags = appPlatformSpecificationDataContract.CpuArchitectureFlags,
         PlatformCategories = appPlatformSpecificationDataContract.PlatformCategories
     });
 }
Beispiel #4
0
        public void RegisterAppPlatformSpecification(AppPlatformSpecificationDataContract appPlatformSpecificationDataContract)
        {
            // update CpuArchitecture
            AppBiz.UpdatePartially(appPlatformSpecificationDataContract.ToApp(), a => a.CpuArchitectureFlags);


            // update AppPlatformCategories
            // fetch app
            var app = _context.Apps.Include("Platforms").Single(a => a.Id == appPlatformSpecificationDataContract.AppId);

            var oldPlatforms = app.Platforms.ToList();

            //var person = PersonBiz.Single(p => p.Id == userId);
            //var role = RoleBiz.Single(r => r.Name == roleName);

            //person.Roles.Add(role);
            // remove all app platforms
            foreach (var platform in oldPlatforms)
            {
                app.Platforms.Remove(platform);
            }

            // fetch all platforms
            // var platformCategories = _context.Platforms.ToList();

            var newPlatforms =
                PlatformBiz.Where(p => appPlatformSpecificationDataContract.PlatformCategories.Contains(p.Id));

            // add platforms that exist in list into appPltforms
            foreach (var platform in newPlatforms)
            {
                app.Platforms.Add(platform);
            }

            _context.SaveChanges();
        }
Beispiel #5
0
 public Task RegisterAppPlatformSpecificationAsync(AppPlatformSpecificationDataContract appPlatformSpecificationDataContract)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public void RegisterAppPlatformSpecification(AppPlatformSpecificationDataContract appPlatformSpecificationDataContract)
 {
     AppDomainService.RegisterAppPlatformSpecification(appPlatformSpecificationDataContract);
 }