public IHttpActionResult Puttb_EmpPromotion(int id, tb_EmpPromotion tb_EmpPromotion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tb_EmpPromotion.ID) { return(BadRequest()); } db.Entry(tb_EmpPromotion).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tb_EmpPromotionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Gettb_EmpPromotion(int id) { tb_EmpPromotion tb_EmpPromotion = db.tb_EmpPromotion.Find(id); if (tb_EmpPromotion == null) { return(NotFound()); } return(Ok(tb_EmpPromotion)); }
public IHttpActionResult Posttb_EmpPromotion(tb_EmpPromotion tb_EmpPromotion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tb_EmpPromotion.Add(tb_EmpPromotion); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tb_EmpPromotion.ID }, tb_EmpPromotion)); }
public IHttpActionResult Deletetb_EmpPromotion(int id) { tb_EmpPromotion tb_EmpPromotion = db.tb_EmpPromotion.Find(id); if (tb_EmpPromotion == null) { return(NotFound()); } db.tb_EmpPromotion.Remove(tb_EmpPromotion); db.SaveChanges(); return(Ok(tb_EmpPromotion)); }