private InventoryItemDTO Insert(InventoryItemDTO inventoryitem, OpenNosContainer context) { InventoryItem entity = Mapper.Map<InventoryItem>(inventoryitem); context.inventoryitem.Add(entity); context.SaveChanges(); return Mapper.Map<InventoryItemDTO>(entity); }
private ShopItemDTO Insert(ShopItemDTO shopitem, OpenNosContainer context) { ShopItem entity = Mapper.Map<ShopItem>(shopitem); context.shopitem.Add(entity); context.SaveChanges(); return Mapper.Map<ShopItemDTO>(entity); }
private InventoryItemDTO Update(InventoryItem entity, InventoryItemDTO inventoryitem, OpenNosContainer context) { using (context) { var result = context.inventoryitem.SingleOrDefault(c => c.InventoryItemId.Equals(inventoryitem.InventoryItemId)); if (result != null) { result = Mapper.Map<InventoryItemDTO, InventoryItem>(inventoryitem, entity); context.SaveChanges(); } } return Mapper.Map<InventoryItemDTO>(entity); }
private ShopItemDTO Update(ShopItem entity, ShopItemDTO shopitem, OpenNosContainer context) { using (context) { var result = context.shopitem.SingleOrDefault(c => c.ShopItemId.Equals(shopitem.ShopItemId)); if (result != null) { result = Mapper.Map<ShopItemDTO, ShopItem>(shopitem, entity); context.SaveChanges(); } } return Mapper.Map<ShopItemDTO>(entity); }
private AccountDTO Update(Account entity, AccountDTO account, OpenNosContainer context) { entity = Mapper.Map<Account>(account); context.SaveChanges(); return Mapper.Map<AccountDTO>(entity); }
private AccountDTO Insert(AccountDTO account, OpenNosContainer context) { Account entity = Mapper.Map<Account>(account); context.account.Add(entity); context.SaveChanges(); return Mapper.Map<AccountDTO>(entity); }
private InventoryDTO Update(Inventory entity, InventoryDTO inventory, OpenNosContainer context) { using (context) { var result = context.inventory.SingleOrDefault(c => c.InventoryId == inventory.InventoryId); if (result != null) { result = Mapper.Map<InventoryDTO, Inventory>(inventory, entity); context.SaveChanges(); } } return Mapper.Map<InventoryDTO>(entity); }
private InventoryDTO Insert(InventoryDTO inventory, OpenNosContainer context) { Inventory entity = new Inventory() { CharacterId = inventory.CharacterId, InventoryItemId = inventory.InventoryItemId, Slot = inventory.Slot, Type = inventory.Type, }; context.inventory.Add(entity); context.SaveChanges(); return Mapper.Map<InventoryDTO>(entity); }
private CharacterDTO Update(Character entity, CharacterDTO character, OpenNosContainer context) { using (context) { var result = context.character.SingleOrDefault(c => c.CharacterId == character.CharacterId); if (result != null) { result = Mapper.Map<CharacterDTO, Character>(character, entity); context.SaveChanges(); } } return Mapper.Map<CharacterDTO>(entity); }
private CharacterDTO Insert(CharacterDTO character, OpenNosContainer context) { Character entity = Mapper.Map<Character>(character); context.character.Add(entity); context.SaveChanges(); return Mapper.Map<CharacterDTO>(entity); }
/// <summary> /// Disposes the current instance of database context. /// </summary> public static void DisposeContext() { if (_context != null) { _context.Dispose(); _context = null; } }
private InventoryItemDTO Insert(InventoryItemDTO inventoryitem, OpenNosContainer context) { InventoryItem entity = new InventoryItem() { Ammo = inventoryitem.Ammo, FireElement = inventoryitem.FireElement, IsFixed = inventoryitem.IsFixed, Color = inventoryitem.Color, Concentrate = inventoryitem.Concentrate, Amount = inventoryitem.Amount, CriticalLuckRate = inventoryitem.CriticalLuckRate, CriticalRate = inventoryitem.CriticalRate, DamageMaximum = inventoryitem.DamageMaximum, DamageMinimum = inventoryitem.DamageMinimum, DarkElement = inventoryitem.DarkElement, DefenceDodge = inventoryitem.DefenceDodge, DistanceDefence = inventoryitem.DistanceDefence, DistanceDefenceDodge = inventoryitem.DistanceDefenceDodge, ElementRate = inventoryitem.ElementRate, HitRate = inventoryitem.HitRate, ItemVNum = inventoryitem.ItemVNum, LightElement = inventoryitem.LightElement, MagicDefence = inventoryitem.MagicDefence, Rare = inventoryitem.Rare, SlDefence = inventoryitem.SlDefence, SlElement = inventoryitem.SlElement, SlHit = inventoryitem.SlHit, SlHP = inventoryitem.SlHP, SpLevel = inventoryitem.SpLevel, SpXp = inventoryitem.SpXp, Upgrade = inventoryitem.Upgrade, WaterElement = inventoryitem.WaterElement, RangeDefence = inventoryitem.RangeDefence, }; context.inventoryitem.Add(entity); try { context.SaveChanges(); } catch (Exception e) { Logger.Log.ErrorFormat(e.Message); } return Mapper.Map<InventoryItemDTO>(entity); }
private InventoryDTO Insert(InventoryDTO inventory, OpenNosContainer context) { Inventory entity = Mapper.Map<Inventory>(inventory); context.inventory.Add(entity); context.SaveChanges(); return Mapper.Map<InventoryDTO>(entity); }