Ejemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] WordData wordData)
        {
            wordData.CreationDate = DateTime.Now;
            wordData.Validated    = false;
            _wordContext.Add(wordData);
            _wordContext.SaveChanges();

            return(Ok(wordData));
        }
Ejemplo n.º 2
0
        // Action created to support create new rank value when user lose 3 chances and the game.
        public async Task <IActionResult> CreateRank([Bind("ID,Email,Points")] Rank rank)
        {
            // If model that we get as a parameter is valid, we can add new record to database table.
            if (ModelState.IsValid)
            {
                _context.Add(rank);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Fiszki"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ID,Email,Points")] Rank rank)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rank);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(rank));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,content,secret")] Word word)
        {
            int[] Alien = gereate_public(5, 17);
            word.secret = Encrypt(Alien, word.content);

            if (ModelState.IsValid)
            {
                _context.Add(word);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(word));
        }