public async Task <IActionResult> PostMaltidPortionstyp([FromBody] MaltidPortionstyp maltidPortionstyp) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MaltidPortionstyp.Add(maltidPortionstyp); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMaltidPortionstyp", new { id = maltidPortionstyp.Portionstyp_ID }, maltidPortionstyp)); }
public async Task <IActionResult> PutMaltidPortionstyp([FromRoute] string id, [FromBody] MaltidPortionstyp maltidPortionstyp) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != maltidPortionstyp.Portionstyp_ID) { return(BadRequest()); } _context.Entry(maltidPortionstyp).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MaltidPortionstypExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }