public async Task <IActionResult> Update([FromBody] TypWyrobu entity) { if (entity == null) { return(BadRequest("Bad model")); } try { _ctx.Entry(entity).State = EntityState.Modified; await _ctx.SaveChangesAsync(); return(NoContent()); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public async Task <IActionResult> Create([FromBody] TypWyrobu part) { if (part == null) { return(BadRequest("Bad model")); } try { _ctx.TypWyrobu.Add(part); await _ctx.SaveChangesAsync(); return(Created("", part)); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }