public async Task <IActionResult> Post([FromBody] WordData wordData) { wordData.CreationDate = DateTime.Now; wordData.Validated = false; _wordContext.Add(wordData); _wordContext.SaveChanges(); return(Ok(wordData)); }
// 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")); }
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)); }
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)); }