示例#1
0
        public async Task <IActionResult> PutLehrer([FromRoute] int id, [FromBody] Lehrer lehrer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lehrer.LehrerID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
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());
        }