public async Task <IActionResult> PutLeadDetails([FromRoute] int id, [FromBody] LeadDetails leadDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != leadDetails.leadId) { return(BadRequest()); } _context.Entry(leadDetails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeadDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostLeadDetails([FromBody] LeadDetails leadDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.LeadDetails.Add(leadDetails); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLeadDetails", new { id = leadDetails.leadId }, leadDetails)); }