public async Task <ActionResult <Crise> > PostCrise(Crise crise) { _context.Crise.Add(crise); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCrise", new { id = crise.Id }, crise)); }
public async Task <IActionResult> PutCrise(int id, Crise crise) { if (id != crise.Id) { return(BadRequest()); } _context.Entry(crise).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CriseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Crise RandomCrise() { //Get random crisis int randomCrise = Random.Range(0, crises.Count); currentCrise = crises[randomCrise]; crises.Remove(currentCrise); return(currentCrise); }
public void Start() { currentCrise = CriseController.Instance.RandomCrise(); string q = currentCrise.question; randomName = Projeto.Instance.Equipe [Random.Range(0, Projeto.Instance.Equipe.Count)].name; question.text = q.Replace("{name1}", randomName); //Create answers foreach (Answers a in currentCrise.answers) { GameObject newButton = Instantiate(answerButton, buttonParent); newButton.GetComponent <AnswerButton> ().SetAnswer(a, this, randomName); myButtons.Add(newButton); } closeButton.SetActive(false); }