Exemple #1
0
        public async Task <ConfigurationPC> Update(ConfigurationPC configurationPC)
        {
            _context.ConfigurationPCs.Update(configurationPC);
            await _context.SaveChangesAsync();

            return(configurationPC);
        }
Exemple #2
0
        public async Task <ConfigurationPC> Add(ConfigurationPC configurationPC)
        {
            await _context.ConfigurationPCs.AddAsync(configurationPC);

            await _context.SaveChangesAsync();

            return(configurationPC);
        }
Exemple #3
0
 public static ConfigurationPcModel Map(this ConfigurationPC configuration)
 {
     return(new ConfigurationPcModel
     {
         Id = configuration.Id,
         Image = configuration.Image,
         Description = configuration.Description,
         Name = configuration.Name,
         Components = configuration.Components.Select(s => s.Component.Map())
     });
 }
Exemple #4
0
        public static ConfigurationPcModel Map(this ConfigurationPC configuration)
        {
            return(new ConfigurationPcModel
            {
                Id = configuration.Id,
                ImagePath = configuration.ImagePath,
                Description = configuration.Description,
                Name = configuration.Name,

                Components = configuration.Components.Count() > 0 && configuration.Components.First().Component != null?configuration.Components.Select(s => s.Component.Map(s.Amount)).OrderBy(o => o.Type) : null
            });
        }
Exemple #5
0
        public async Task <ConfigurationPC> Add(AddConfigurationPCCommand command)
        {
            var configurationPC = new ConfigurationPC
            {
                Id          = Guid.NewGuid(),
                Name        = command.Name,
                Description = command.Description,
                ImagePath   = command.ImagePath,
            };

            configurationPC.Components = createConfigurationComponents(command.Components, configurationPC.Id);

            await _configurationPCRepository.Add(configurationPC);

            return(configurationPC);
        }
        public async Task <ConfigurationPC> Update(UpdateConfigurationPCCommand command)
        {
            var configurationPC = new ConfigurationPC
            {
                Id          = Guid.Parse(command.Id),
                Name        = command.Name,
                Description = command.Description,
                Image       = command.Image,
                // Components=command.Components
            };

            configurationPC.Components = updateConfigurationComponents(command.Components, configurationPC.Id);

            await _configurationPCRepository.Update(configurationPC);

            return(configurationPC);
        }
Exemple #7
0
        public async Task <ConfigurationPC> Update(UpdateConfigurationPCCommand command)
        {
            var configurationPC = new ConfigurationPC
            {
                Id          = command.Id,
                Name        = command.Name,
                Description = command.Description,
                ImagePath   = command.ImagePath,
            };
            await _configurationPCRepository.RemoveComponents(command.Id);

            var components = createConfigurationComponents(command.Components, configurationPC.Id);

            await _configurationPCRepository.Update(configurationPC);

            await _configurationPCRepository.CreateConfigurationComponents(components);

            return(configurationPC);
        }