public IHttpActionResult PutEmployye(int id, Employye employye) { if (id != employye.EmployeeID) { return(BadRequest()); } db.Entry(employye).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployyeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostEmployye(Employye employye) { db.Employye.Add(employye); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = employye.EmployeeID }, employye)); }
public IHttpActionResult DeleteEmployye(int id) { Employye employye = db.Employye.Find(id); if (employye == null) { return(NotFound()); } db.Employye.Remove(employye); db.SaveChanges(); return(Ok(employye)); }
public IHttpActionResult PostEmployye(Employye employye) { db.Employye.Add(employye); try { db.SaveChanges(); } catch (DbUpdateException) { if (EmployyeExists(employye.EmployeeID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = employye.EmployeeID }, employye)); }