Example #1
0
        public async Task <IActionResult> PutParanoia([FromRoute] int id, [FromBody] Paranoia paranoia)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != paranoia.Id)
            {
                return(BadRequest());
            }

            _context.Entry(paranoia).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ParanoiaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
 private void main()
 {
     Screen.InitScreen();
     p = new Paranoia();
     Clear();
     PrintResponse(p.Instructions());
     More();
     PrintResponse(p.Character());
     More();
     Play();
 }
Example #3
0
        public async Task <IActionResult> PostParanoia([FromBody] Paranoia paranoia)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Paranoia.Add(paranoia);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetParanoia", new { id = paranoia.Id }, paranoia));
        }