public async Task <IActionResult> PutcustomerMaster([FromRoute] int id, [FromBody] customerMaster customerMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customerMaster.custId) { return(BadRequest()); } _context.Entry(customerMaster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!customerMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostcustomerMaster([FromBody] customerMaster cust) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.customerMasters.Add(cust); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFlat", new { id = cust.flatNo }, cust)); }