Esempio n. 1
0
        public async Task <IActionResult> PutNotenerhebung([FromRoute] int id, [FromBody] Notenerhebung notenerhebung)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != notenerhebung.NotenerhebungID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> PostNotenerhebung([FromBody] Notenerhebung notenerhebung)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Notenerhebung.Add(notenerhebung);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetNotenerhebung", new { id = notenerhebung.NotenerhebungID }, notenerhebung));
        }