public IHttpActionResult PuttblAdvertGift(int id, tblAdvertGift tblAdvertGift) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblAdvertGift.IdAdvertGift) { return(BadRequest()); } db.Entry(tblAdvertGift).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblAdvertGiftExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GettblAdvertGift(int id) { tblAdvertGift tblAdvertGift = db.tblAdvertGifts.Find(id); if (tblAdvertGift == null) { return(NotFound()); } return(Ok(tblAdvertGift)); }
public IHttpActionResult PosttblAdvertGift(tblAdvertGift tblAdvertGift) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tblAdvertGifts.Add(tblAdvertGift); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tblAdvertGift.IdAdvertGift }, tblAdvertGift)); }
public IHttpActionResult DeletetblAdvertGift(int id) { tblAdvertGift tblAdvertGift = db.tblAdvertGifts.Find(id); if (tblAdvertGift == null) { return(NotFound()); } db.tblAdvertGifts.Remove(tblAdvertGift); db.SaveChanges(); return(Ok(tblAdvertGift)); }