Exemplo n.º 1
0
        public async Task <ActionResult <Personmodell> > PostPersonmodell(Personmodell personmodell)
        {
            _context.Personer.Add(personmodell);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPersonmodell", new { id = personmodell.Persnr }, personmodell));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutPersonmodell(long id, Personmodell personmodell)
        {
            if (id != personmodell.Persnr)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }