public async Task <RepositoryResultTypes> UpdateAsync(int id, LeadInformation lead) { if (id != lead.Id) { return(RepositoryResultTypes.BadRequest); } _context.Entry(lead).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeadInformationExists(id)) { return(RepositoryResultTypes.NotFound); } else { return(RepositoryResultTypes.Error); } } return(RepositoryResultTypes.NoContent); }
public async Task <IActionResult> PutLeadInformation(int id, LeadInformation leadInformation) { if (id != leadInformation.Id) { return(BadRequest()); } _context.Entry(leadInformation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeadInformationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }