Beispiel #1
0
        public async Task <ActionResult <PostAdresse> > PostPostAdresse(PostAdresse postAdresse)
        {
            _context.PostAdresse.Add(postAdresse);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPostAdresse", new { id = postAdresse.PostNr }, postAdresse));
        }
Beispiel #2
0
        public async Task <IActionResult> PutPostAdresse(int id, PostAdresse postAdresse)
        {
            if (id != postAdresse.PostNr)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }