public async Task <IActionResult> PutCcompany([FromRoute] int id, [FromBody] Ccompany ccompany) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ccompany.CmpId) { return(BadRequest()); } _context.Entry(ccompany).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CcompanyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostCcompany([FromBody] Ccompany ccompany) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Ccompany.Add(ccompany); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCcompany", new { id = ccompany.CmpId }, ccompany)); }