public void UpdateEmployee(Employee employee) { using (var dbContext = new PortfolioProjectContext()) { dbContext.Entry(employee).State = EntityState.Modified; dbContext.SaveChanges(); } }
public HttpStatusCode UpdateEmployee(Employee employee) { using (var dbContext = new PortfolioProjectContext()) { if (employee != null) { try { dbContext.Entry(employee).State = EntityState.Modified; dbContext.SaveChanges(); } catch { return(HttpStatusCode.InternalServerError); } } else { return(HttpStatusCode.NotFound); } } return(HttpStatusCode.OK); }