public async Task <ActionResult> Detail(Guid?id, int page = 1) { if (id == null) { return(RedirectToAction("Index")); } var u = await UserFacade.GetUserAccordingToUsernameAsync(User.Identity.Name); var lowerBound = u.Character.Level - 2; var upperBound = lowerBound + 4; var shop = await ShopFacade.GetAsync(id.GetValueOrDefault()); var list = new List <ItemDto>(shop.Items.Where(i => i.RequiredLevel >= lowerBound && i.RequiredLevel <= upperBound).ToList()); ViewBag.Count = list.Count; ViewBag.Current = page; shop.Items = list.OrderByDescending(a => a.Quality).ThenByDescending(a => a.RequiredLevel).Skip((page - 1) * 12).Take(12).ToList(); var model = new ShopCharacterModel() { Character = u.Character, Shop = shop }; return(View(model)); }
public static ShopFacade getInstance() { if (Inst == null) { Inst = new ShopFacade(); } return(Inst); }
private void validateAddNewProduct(IEnumerable <ProductInfo> allProducts, ProductInfo newProduct, IEnumerable <ProductInfo> expected) { var actual = allProducts.ToList(); var sut = new ShopFacade(); sut.AddNewProduct(actual, newProduct); expected.Should().BeEquivalentTo(actual); }
// GET: Shop public async Task <ActionResult> Index() { var u = await UserFacade.GetUserAccordingToUsernameAsync(User.Identity.Name); if (u.Character == null) { return(RedirectToAction("Detail", "User")); } var list = await ShopFacade.GetAllAsync(); return(View(list)); }
private void OnClickBuy(EventContext context) { var id = (int)(context.sender as GObject).data; var deploy = WantSellDeploy.GetInfo(id); var itemData = new ItemData(); itemData.Name = Data.Name; itemData.Value = deploy.Value; itemData.Id = Data.Id; itemData.Type = Data.Type; itemData.Count = 1; ShopFacade.getInstance().SellGoods(itemData); Hide(); }
private void OnSell(EventContext context) { if (Data.Type == EGoodsType.WuXue) { WinCenter.inst.ShowPanel <UIGainSkill>(Data, 1); } else { var itemData = new ItemData(); itemData.Name = Data.Name; itemData.Value = Data.Value; itemData.Id = Data.Id; itemData.Type = Data.Type; itemData.Count = 1; ShopFacade.getInstance().SellGoods(itemData); } }
public void Setup() { var options = new DbContextOptionsBuilder <PlayerContext>().UseInMemoryDatabase(databaseName: "PlayerList").Options; Database = new PlayerContext(options); Command = new List <ICommand>(); Player = new Player { health_points = 100, Name = "Julius", speed = 10, PosX = 100, PosY = 100 }; Weapon = new Weapon { PlayerID = 0, cost = 100, damage = 75 }; Command.Add(new UpCommand(Player)); Command.Add(new DownCommand(Player)); Command.Add(new LeftCommand(Player)); Command.Add(new RightCommand(Player)); ObsFactory = new ObsticaleFacotry(); WeaponsFacotry = new WeaponsFacotry(); Shop = new ShopFacade(); }
static void Main(string[] args) { ShopFacade.Instance().buyProductByCashWithFreeShipping("*****@*****.**"); ShopFacade.Instance().buyProductByPaypalWithStandardShipping("*****@*****.**"); }