public void CreateItem(ItemDTO itemDTO) { var item = new Item(); item.Id = Guid.NewGuid(); item.CategoryID = itemDTO.CategoryID; item.Name = itemDTO.Name; item.ManufCountryID = itemDTO.ManufCountryID; item.Description = itemDTO.Description; item.BrandID = itemDTO.BrandID; item.BrandCountryID = itemDTO.BrandCountryID; _itemRepository.Create(item); // Creating characteristics for a new item var categoryCharacteristics = GetAllChainCategoryCharacteristics((Guid)itemDTO.CategoryID); foreach (var i in categoryCharacteristics) { var itemCharacteristic = new ItemCharacteristic(); itemCharacteristic.Id = Guid.NewGuid(); itemCharacteristic.ItemID = item.Id; itemCharacteristic.CharacteristicID = i.CharacteristicID; _itemCharacteristicRepository.Create(itemCharacteristic); } }
public void CreateItemCharacteristic(ItemCharacteristicDTO itemCharacteristicDTO) { var itemCharacteristic = new ItemCharacteristic(); itemCharacteristic.Id = Guid.NewGuid(); itemCharacteristic.ItemID = itemCharacteristicDTO.ItemID; itemCharacteristic.CharacteristicID = itemCharacteristicDTO.CharacteristicID; itemCharacteristic.CharValueID = itemCharacteristicDTO.CharValueID; _itemCharacteristicRepository.Create(itemCharacteristic); }
public void UpdateItemCharacteristic(ItemCharacteristicDTO itemCharacteristicDTO) { var itemCharacteristic = new ItemCharacteristic(); itemCharacteristic.Id = (Guid)itemCharacteristicDTO.Id; itemCharacteristic.ItemID = itemCharacteristicDTO.ItemID; itemCharacteristic.CharacteristicID = itemCharacteristicDTO.CharacteristicID; itemCharacteristic.CharValueID = itemCharacteristicDTO.CharValueID; _itemCharacteristicRepository.Update(itemCharacteristic); }