Exemplo n.º 1
0
 public IActionResult OnGet(string message = "")
 {
     ViewData["message"] = message;
     if (this.User.Identity.IsAuthenticated)
     {
         //logined
         var          currentUserId = Convert.ToInt32(User.Claims.FirstOrDefault(claim => claim.Type == ClaimTypes.NameIdentifier)?.Value ?? "-1");
         var          context       = _context.UniversityPrograms.Where(program => program.BelongsToUserId == currentUserId);
         List <_Card> _Cards        = new List <_Card>();
         foreach (var program in context)
         {
             var oneCard = new _Card();
             oneCard.Head      = program.Id.ToString();
             oneCard.BodyTitle = program.ProgramName;
             oneCard.Body      = string.Format("This processor has been called {0} times", 25);
             oneCard.Btn0URL   = Url.Content("/" + User.Claims.FirstOrDefault(claim => claim.Type == ClaimTypes.Role)?.Value ?? "SchoolAdmin" + "/Edit");
             oneCard.Btn0Label = "Edit";
             oneCard.Btn1URL   = Url.Content("/SchoolAdmin/Reset");
             oneCard.Btn1Label = "Reset";
             _Cards.Add(oneCard);
         }
         ViewData["CardList"] = _Cards;
         return(Page());
     }
     else
     {
         return(RedirectToPage("/Index"));
     }
 }
Exemplo n.º 2
0
 public IActionResult OnGet(string message = "")
 {
     ViewData["message"] = message;
     if (this.User.Identity.IsAuthenticated)
     {
         //logined
         var          currentUserId = Convert.ToInt32(User.Claims.FirstOrDefault(claim => claim.Type == ClaimTypes.NameIdentifier)?.Value ?? "-1");
         var          context       = _context.Processers.Where(procer => procer.belongsToUserID == currentUserId);
         List <_Card> _Cards        = new List <_Card>();
         foreach (var oneProcesser in context)
         {
             var oneCard = new _Card();
             oneCard.Head      = oneProcesser.Id.ToString();
             oneCard.BodyTitle = oneProcesser.friendlyName;
             oneCard.Body      = string.Format("This processor has been called {0} times", oneProcesser.count);
             oneCard.Btn0URL   = Request.Path + "/Edit?id=" + oneProcesser.Id;
             oneCard.Btn0Label = "Edit";
             oneCard.Btn1URL   = Request.Path + "/Delete?id=" + oneProcesser.Id;
             oneCard.Btn1Label = "Delete";
             _Cards.Add(oneCard);
         }
         ViewData["CardList"] = _Cards;
         return(Page());
     }
     else
     {
         return(RedirectToPage("/Index"));
     }
 }
Exemplo n.º 3
0
        public IActionResult OnGet(string message = "")
        {
            ViewData["message"] = message;
            var          context = _context.UniversityPrograms?.ToArray() ?? null;
            List <_Card> _Cards  = new List <_Card>();

            foreach (var program in context)
            {
                var oneCard = new _Card();
                oneCard.Head      = program.Id.ToString();
                oneCard.BodyTitle = program.ProgramName;
                oneCard.Body      = program.ProgramIntroduction;
                oneCard.Btn0URL   = "info";
                oneCard.Btn0Label = "info";
                oneCard.Btn1URL   = Request.Path + "/Apply?id=" + program.Id;;
                oneCard.Btn1Label = "ApplyNow";
                _Cards.Add(oneCard);
            }
            ViewData["CardList"] = _Cards;
            return(Page());
        }
Exemplo n.º 4
0
 // playerName: カードを所持するプレイヤーの名前
 // card: 見えているカード
 public _VisibleCard(string playerName, _Card card)
 {
     PlayerName = playerName;
     Card       = card;
 }