Example #1
0
        public async Task <ActionResult <Persions> > PostPersions(Persions persions)
        {
            _context._Persions.Add(persions);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPersions", new { id = persions.id }, persions));
        }
Example #2
0
        public async Task <IActionResult> PutPersions(int id, Persions persions)
        {
            if (id != persions.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }