예제 #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());
        }
예제 #3
0
        public async Task <IActionResult> PutFachSchueler([FromRoute] int fachId, [FromRoute] int schuelerId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = new FachSchueler {
                FachID = fachId, SchuelerID = schuelerId
            };

            _context.FachSchueler.Add(result);
            await _context.SaveChangesAsync();

            return(Created("", result));
        }
예제 #4
0
        public async Task <IActionResult> PutKlasseLehrer([FromRoute] int klasseId, [FromRoute] int lehrerId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = new KlasseLehrer {
                KlasseID = klasseId, LehrerID = lehrerId
            };

            _context.KlasseLehrer.Add(result);
            await _context.SaveChangesAsync();

            return(Created("", result));
        }