/// <summary>
        /// Converts a business object to an API dto object
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IAPIEntity ToAPIFormat(IBusinessObjectEntity entity)
        {
            ExperienceLevel other = entity as ExperienceLevel;
            ExperienceLevelAPI clone = new ExperienceLevelAPI();

            clone.Level = other.Level;
            clone.ExperienceRequired = other.ExperienceRequired;

            return clone;
        }
        /// <summary>
        /// Translates an IBusinessObjectEntity to an ITableStorageEntity
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override ITableStorageEntity ToTableStorage(IBusinessObjectEntity entity)
        {
            BuildableItemTableStorage ts = (BuildableItemTableStorage)Mapper
                .Map(entity, entity.GetType(), typeof(BuildableItemTableStorage));
            
            ts.PartitionKey = PartitionKey;
            ts.RowKey = RowKey;

            return ts;
        }
        /// <summary>
        /// Translates an IBusinessObjectEntity to an ITableStorageEntity
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override ITableStorageEntity ToTableStorage(IBusinessObjectEntity entity)
        {
            ExperienceLevelTableStorage ts = Mapper
               .Map<ExperienceLevel, ExperienceLevelTableStorage>(
                   (ExperienceLevel)entity);

            ts.PartitionKey = PartitionKey;
            ts.RowKey = RowKey;

            return ts;
        }
        /// <summary>
        /// Translates an IBusinessObjectEntity to an ITableStorageEntity
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override ITableStorageEntity ToTableStorage(IBusinessObjectEntity entity)
        {
            GamePlayerTableStorage ts = Mapper
                .Map<GamePlayer, GamePlayerTableStorage>(
                    (GamePlayer)entity);

            ts.PartitionKey = PartitionKey;
            ts.RowKey = RowKey;

            return ts;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Converts a business object to an API dto object
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IAPIEntity ToAPIFormat(IBusinessObjectEntity entity)
        {
            GamePlayerAPI clone = new GamePlayerAPI();
            GamePlayer other = entity as GamePlayer;

            clone.Coins = other.Coins;
            clone.Coupons = other.Coupons;
            clone.Experience = other.Experience;
            clone.Level = other.Level;
            clone.TutorialStage = other.TutorialStage;
            clone.StateChanged = other.StateChanged;
            clone.Locations = other.Locations;
            clone.WorkInProgress = other.WorkInProgress;

            return clone;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Converts a business object to an API dto object
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IAPIEntity ToAPIFormat(IBusinessObjectEntity entity)
        {
            BuildableItemAPI api = new BuildableItemAPI();

            BuildableItem bi = entity as BuildableItem;
            api.ItemCode = bi.ItemCode;

            WorkItem workItem = entity as WorkItem;
            if (workItem != null)
            {
                api.WorkItem = workItem;
                return api;
            }

            ProductionItem productionItem = entity as ProductionItem;
            if (productionItem != null)
            {
                api.ProductionItem = productionItem;
                return api;
            }

            ConsumableItem consumableItem = entity as ConsumableItem;
            if (consumableItem != null)
            {
                api.ConsumableItem = consumableItem;
                return api;
            }

            StorageItem storageItem = entity as StorageItem;
            if (storageItem != null)
            {
                api.StorageItem = storageItem;
                return api;
            }

            return null;
        }
 /// <summary>
 /// Translates an IBusinessObjectEntity to an ICacheEntity
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public override ICacheEntity ToCache(IBusinessObjectEntity item)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Translates an IBusinessObjectEntity to an ICacheEntity
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public override ICacheEntity ToCache(IBusinessObjectEntity entity)
 {
     return Mapper
         .Map<GamePlayer, GamePlayerCacheable>(
             (GamePlayer)entity);
 }
 /// <summary>
 /// Translates an IBusinessObjectEntity to an ITableStorageEntity
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public abstract ITableStorageEntity ToTableStorage(IBusinessObjectEntity entity);
Exemplo n.º 10
0
 /// <summary>
 /// Translates an IBusinessObjectEntity to an ICacheEntity
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public abstract ICacheEntity ToCache(IBusinessObjectEntity entity);