public async Task <IActionResult> PutMaterail(int id, Materail materail) { if (id != materail.MaterailId) { return(BadRequest()); } _context.Entry(materail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MaterailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Materail> > PostMaterail(Materail materail) { _context.Materail.Add(materail); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (MaterailExists(materail.MaterailId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetMaterail", new { id = materail.MaterailId }, materail)); }