예제 #1
0
 private InventoryItemDTO Insert(InventoryItemDTO inventoryitem, OpenNosContainer context)
 {
     InventoryItem entity = Mapper.Map<InventoryItem>(inventoryitem);
     context.inventoryitem.Add(entity);
     context.SaveChanges();
     return Mapper.Map<InventoryItemDTO>(entity);
 }
예제 #2
0
 private ShopItemDTO Insert(ShopItemDTO shopitem, OpenNosContainer context)
 {
     ShopItem entity = Mapper.Map<ShopItem>(shopitem);
     context.shopitem.Add(entity);
     context.SaveChanges();
     return Mapper.Map<ShopItemDTO>(entity);
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 private AccountDTO Update(Account entity, AccountDTO account, OpenNosContainer context)
 {
     entity = Mapper.Map<Account>(account);
     context.SaveChanges();
     return Mapper.Map<AccountDTO>(entity);
 }
예제 #6
0
 private AccountDTO Insert(AccountDTO account, OpenNosContainer context)
 {
     Account entity = Mapper.Map<Account>(account);
     context.account.Add(entity);
     context.SaveChanges();
     return Mapper.Map<AccountDTO>(entity);
 }
예제 #7
0
        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);
        }
예제 #8
0
 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);
 }
예제 #9
0
        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);
        }
예제 #10
0
 private CharacterDTO Insert(CharacterDTO character, OpenNosContainer context)
 {
     Character entity = Mapper.Map<Character>(character);
     context.character.Add(entity);
     context.SaveChanges();
     return Mapper.Map<CharacterDTO>(entity);
 }
예제 #11
0
 /// <summary>
 /// Disposes the current instance of database context.
 /// </summary>
 public static void DisposeContext()
 {
     if (_context != null)
     {
         _context.Dispose();
         _context = null;
     }
 }
예제 #12
0
        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);
        }
예제 #13
0
 private InventoryDTO Insert(InventoryDTO inventory, OpenNosContainer context)
 {
     Inventory entity = Mapper.Map<Inventory>(inventory);
     context.inventory.Add(entity);
     context.SaveChanges();
     return Mapper.Map<InventoryDTO>(entity);
 }