public async Task <IActionResult> Index() { var user = await CurrentUser(); var cardsViewModel = new CardsViewModel() { TotalNumberOfReports = _reportService.GetReportCountByUserId(user.Id), NumberOfTasksCompleted = _assignmentService.GetCompletedTaskCountByUserId(user.Id), NumberOfMissionsCompleted = _assignmentService.GetInCompletedTaskCountByUserId(user.Id), UnreadNotifications = _notificationService.GetUnreadNotificationsCountByUserId(user.Id) }; return(View(cardsViewModel)); }
/// <summary> /// Converts the statistic to a cards viewmodel. /// </summary> /// <param name="statistic">The statistic.</param> /// <returns>Cards viewmodel</returns> public CardsViewModel ConvertStatistic(IStatistic statistic) { var result = new CardsViewModel(); if (statistic == null) { return(result); } foreach (var converter in _converters.OrderBy(c => c.Order)) { result.Cards.Add(converter.Convert(statistic)); } return(result); }
public async Task <ActionResult> PlayGame() { CardsViewModel game = new CardsViewModel(); game.deckId = Request.QueryString["deck_id"]; game.dealer = new person(); game.player = new person(); game.dealer.hand = new List <Card>(); game.player.hand = new List <Card>(); for (int i = 0; i < 2; i++) { game.dealer.hand.Add(await GetACard(game.deckId)); game.player.hand.Add(await GetACard(game.deckId)); } Session["gameSession"] = game; return(View(game)); }
private CardsViewModel LoadSomeData() { ObservableCollection <CardViewModel> cards = new ObservableCollection <CardViewModel>(); cards.Add(new CardViewModel() { Age = 1, Name = "Dan", Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg")) }); cards.Add(new CardViewModel() { Age = 2, Name = "Gill", Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg")) }); cards.Add(new CardViewModel() { Age = 3, Name = "Glyn", Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg")) }); cards.Add(new CardViewModel() { Age = 4, Name = "Lorna", Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg")) }); cards.Add(new CardViewModel() { Age = 5, Name = "Holly", Picture = new Bitmap(Image.FromFile("C:\\Users\\daniel.rayson\\Pictures\\CuteKitten1.jpg")) }); CardsViewModel VM = new CardsViewModel() { Cards = cards }; return(VM); }
//public int qtde { get; private set; } public ActionResult Index() { CardsViewModel cards = new CardsViewModel(); // Músicas do último evento cards.ultimasMusicas = db.evento.OrderByDescending(e => e.dt_evento).ThenByDescending(e => e.cd_tipo_evento).FirstOrDefault(); // Tópicos mais tocados //List<evento_musica> generosMaisTocados = (from em in db.evento_musica // join h in db.hino on em.cd_hino equals h.cd_hino // join hg in db.hino_genero on h.cd_hino equals hg.cd_hino // join gl in db.genero_letra on hg.cd_genero equals gl.cd_genero_letra // where hg.id_genero == "L" // select em).GroupBy(em => em.cd_hino).Count().ToList(); // Músicas mais tocadas var topicosMaisCantados = (from em in db.evento_musica join m in db.hino on em.cd_hino equals m.cd_hino join hg in db.hino_genero on m.cd_hino equals hg.cd_hino join gl in db.genero_letra on hg.cd_genero equals gl.cd_genero_letra where hg.id_genero == "L" group em by gl.tx_genero_letra into g select new { genero = g.Key, qtde = g.Count() }).OrderByDescending(g => g.qtde).ToList(); cards.topicosMaisCantados = topicosMaisCantados.Select(m => new Models.topicoQtde { topico = m.genero, qtde = m.qtde }).ToList(); // Músicas mais tocadas var musicasMaisCantadas = (from em in db.evento_musica join m in db.hino on em.cd_hino equals m.cd_hino group em by m.tx_titulo_hino into g select new { musica = g.Key, qtde = g.Count() }).OrderByDescending(g => g.qtde).ToList(); cards.musicasMaisCantadas = musicasMaisCantadas.Select(m => new Models.musicaQtde { musica = m.musica, qtde = m.qtde }).ToList(); return(View(cards)); }
public async Task <ActionResult> PlayGame(string playerHitButton, string playerStayButton) { CardsViewModel game = (CardsViewModel)Session["gameSession"]; if (playerHitButton != null) { game.player.hand.Add(await GetACard(game.deckId)); if (playerHitButton != null && game.dealer.HandValue() <= 15) { game.dealer.hand.Add(await GetACard(game.deckId)); return(View(game)); } if (game.player.HandValue() == 21 || game.dealer.HandValue() > 21) { return(RedirectToAction("Won")); } else if (game.dealer.HandValue() == 21 || game.player.HandValue() > 21) { return(RedirectToAction("Lose")); } if (playerStayButton != null && game.dealer.HandValue() <= 15) { game.dealer.hand.Add(await GetACard(game.deckId)); return(View(game)); } else if (game.player.HandValue() == 21 || game.dealer.HandValue() > 21) { return(RedirectToAction("Won")); } else if (game.dealer.HandValue() == 21 || game.player.HandValue() > 21) { return(RedirectToAction("Lose")); } else { return(View(game)); } } return(View(game)); }
public void ViewModelInitialized(CardsViewModel cardsViewModel) { CardDropped += cardsViewModel.CardDroppedFromHand; }
public ActionResult Deposit(CardsViewModel viewModel) { if (!ModelState.IsValid) { return(View(viewModel)); } var info = new RequestInfo { //Merchant site id Merchant_id = _merchantId, //Email tài khoản nhận tiền khi nạp Merchant_acount = _merchantEmail, //Mật khẩu giao tiếp khi đăng ký merchant site Merchant_password = _merchantPassword, //Nhà mạng CardType = viewModel.CardType, Pincard = viewModel.PinCard, //Mã đơn hàng Refcode = (new Random().Next(0, 10000)).ToString(), SerialCard = viewModel.SerialCard }; var result = NLCardLib.CardChage(info); string html = ""; var applyResult = new CardsViewModel(); if (result.Errorcode.Equals("00")) { html += "<div>" + result.Message + "</div>"; html += "<div>Số tiền nạp : <b>" + result.Card_amount + "</b> đ</div>"; html += "<div>Mã giao dịch : <b>" + result.TransactionID + "</b></div>"; html += "<div>Mã đơn hàng : <b>" + result.Refcode + "</b></div>"; applyResult.Result.Message = html; applyResult.Result.Result = true; var coin = int.Parse(result.Card_amount); coin = (coin / 1000 * 8) / 10; _applicationUserService.UpdateCoin(User.Identity.GetUserId(), coin); _applicationUserService.SaveChanges(); var transactionHistory = new TransactionHistory { CardOwner = User.Identity.GetUserId(), Description = $"Mã thẻ: {info.Pincard} | Seri thẻ: { info.SerialCard }", Money = Decimal.Parse(result.Card_amount), MoneyInSite = coin }; this.transactionHistoryService.AddTransactionHistory(transactionHistory); _applicationUserService.SaveChanges(); return(View("Deposit", applyResult)); } html += "<div>Nạp thẻ không thành công</div>"; html += "<div>" + result.Message + "</div>"; applyResult.Result.Message = html; applyResult.Result.Result = false; return(View("Deposit", applyResult)); }
public ActionResult Deposit() { var viewModel = new CardsViewModel(); return(View(viewModel)); }
public CardsPage() { InitializeComponent(); BindingContext = viewModel = new CardsViewModel(); }
public void ViewModelInitialized(CardsViewModel cardsViewModel) { _button.onClick.AddListener(cardsViewModel.RandomizeNextCard); }
public BankView() { DataContext = new CardsViewModel(); InitializeComponent(); }
// GET: Cards public ActionResult Index() { var model = new CardsViewModel(_card, _tellTheTime); return(View(model)); }
public DactyloscopyView() { DataContext = new CardsViewModel(); InitializeComponent(); }
public CardsPanel(CardsViewModel viewModel) { ViewModel = viewModel; ViewModel.Cards.CollectionChanged += Cards_CollectionChanged; }
public void InitializeViewModel(CardsViewModel viewModel) { _viewModel = viewModel; }
/// <summary> /// Initializes a new instance of the <see cref="DashboardViewModel"/> class. /// </summary> public DashboardViewModel() { Cards = new CardsViewModel(); OpenPositions = new OpenPositionsViewModel(); }