示例#1
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);
        }
示例#2
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);
 }