public async Task <IActionResult> PutSmartEnhed([FromRoute] long id, [FromBody] SmartEnhed smartEnhed) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != smartEnhed.SmartEnhedId) { return(BadRequest()); } _context.Entry(smartEnhed).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SmartEnhedExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostSmartEnhed([FromBody] SmartEnhed smartEnhed) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.SmartEnhed.Add(smartEnhed); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSmartEnhed", new { id = smartEnhed.SmartEnhedId }, smartEnhed)); }