private ShopItemEntity GetEntityFromRequest(CreateShopItemCommand request) { var entity = new ShopItemEntity() { Description = request.Description, MaxAmount = request.MaxAmount, Name = request.Name, Price = request.Price }; return(entity); }
public static CreateShopItemViewModel Create(ShopItemEntity entity, Guid Parent) { return(new CreateShopItemViewModel() { Name = entity.Name, Id = entity.Id, Description = entity.Description, Options = entity.Options.Select(o => Create(o, entity.Id)), Price = entity.Price, MaxAmount = entity.MaxAmount, Parent = Parent }); }
public ShopItem(ShopItemEntity entity, GameDataService gameDataService) { ItemNumber = entity.Id; Gender = (Gender)entity.RequiredGender; License = (ItemLicense)entity.RequiredLicense; ColorGroup = entity.Colors; UniqueColorGroup = entity.UniqueColors; MinLevel = entity.RequiredLevel; MaxLevel = entity.LevelLimit; MasterLevel = entity.RequiredMasterLevel; IsOneTimeUse = entity.IsOneTimeUse; IsDestroyable = entity.IsDestroyable; ItemInfos = entity.ItemInfos.Select(x => new ShopItemInfo(this, x, gameDataService)).ToList(); }
public async Task NewItem(ItemNumber itemNumber) { using (var db = _databaseService.Open <GameContext>()) { var itemEntity = new ShopItemEntity { Id = itemNumber }; db.Items.Add(itemEntity); await db.SaveChangesAsync(); Items.Add(new ShopItem(itemEntity)); } }
public ShopItem(ShopItemEntity entity) { Item = ResourceService.Instance.Items.First(x => x.ItemNumber == entity.Id); ItemNumber = entity.Id; RequiredGender = new ReactiveProperty <Gender>((Gender)entity.RequiredGender); RequiredLicense = new ReactiveProperty <ItemLicense>((ItemLicense)entity.RequiredLicense); Colors = new ReactiveProperty <byte>(entity.Colors); UniqueColors = new ReactiveProperty <byte>(entity.UniqueColors); RequiredLevel = new ReactiveProperty <byte>(entity.RequiredLevel); LevelLimit = new ReactiveProperty <byte>(entity.LevelLimit); RequiredMasterLevel = new ReactiveProperty <byte>(entity.RequiredMasterLevel); IsOneTimeUse = new ReactiveProperty <bool>(entity.IsOneTimeUse); IsDestroyable = new ReactiveProperty <bool>(entity.IsDestroyable); ItemInfos = new ReactiveList <ShopItemInfo>(entity.ItemInfos.Select(x => new ShopItemInfo(this, x))); }
public static ShopItem ToDomain(this ShopItemEntity item) { if (item is null) { return(null); } return(new ShopItem { Id = item.Id, DateCreated = item.DateCreated, Name = item.Name, Description = item.Description, Type = item.Type, Price = item.Price, Quantity = item.Quantity, Images = item.Images }); }