public async Task <IActionResult> PutsupplierMaster([FromRoute] int id, [FromBody] supplierMaster supplierMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != supplierMaster.supId) { return(BadRequest()); } _context.Entry(supplierMaster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!supplierMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IActionResult suplierMasters([FromBody] supplierMaster obj) { if (obj.supId != 0) { _context.supplierMasters.Attach(obj); _context.supplierMasters.Update(obj); } else { _context.supplierMasters.Add(obj); } _context.SaveChanges(); return(new ObjectResult("Supplier Added Successfully")); }