public async Task <bool> AddNoReturn(ComponentInComputerMinimal bllComponentInComputer) { var componentsInComputers = await ServiceRepository.AllAsyncFull(); var thisComputerComponents = componentsInComputers.Where(cic => cic.ComputerId == bllComponentInComputer.ComputerId).ToList(); var toBeChecked = _compatibilityCheckList[bllComponentInComputer.ComponentTypeName]; foreach (var typeName in toBeChecked) { var componentsWithType = thisComputerComponents.Where(cic => cic.Component !.ComponentType !.ComponentTypeName == typeName).ToList(); var isCompatible = true; foreach (var componentt in componentsWithType) { isCompatible = await CheckCompatibility(bllComponentInComputer.ComponentId, componentt); if (!isCompatible) { break; } } if (!isCompatible) { Console.WriteLine("Incompatible components"); return(false); } } var component = thisComputerComponents.FirstOrDefault(t => t.Component !.ComponentTypeId.Equals(bllComponentInComputer.ComponentTypeId) && t.Component.ComponentType !.ComponentTypeName != "Storage"); if (component == null) { ServiceRepository.AddNoReturn(_mapper.MapToDALMinimal(bllComponentInComputer)); return(true); } if (component != null) { Console.WriteLine("Duplicate non storage type on pc detected, skipping add"); } return(false); }
public ComponentInComputer MapToDomain(ComponentInComputerMinimal dalComponentInComputerMinimal) { return(Map <ComponentInComputerMinimal, ComponentInComputer>(dalComponentInComputerMinimal)); }
public void RemoveNoReturnAsync(ComponentInComputerMinimal dalComponentInComputerMinimal) { RepoDbSet.Remove(_mapper.MapToDomain(dalComponentInComputerMinimal)); }
public void AddNoReturn(ComponentInComputerMinimal dalComponentInComputerMinimal) { RepoDbSet.Add(_mapper.MapToDomain(dalComponentInComputerMinimal)); }
public void RemoveNoReturnAsync(ComponentInComputerMinimal bllComponentInComputer) { ServiceRepository.RemoveNoReturnAsync(_mapper.MapToDALMinimal(bllComponentInComputer)); }