public IHttpActionResult PuttblShopProductImage(int id, tblShopProductImage tblShopProductImage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblShopProductImage.ID) { return(BadRequest()); } db.Entry(tblShopProductImage).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblShopProductImageExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GettblShopProductImage(int id) { tblShopProductImage tblShopProductImage = db.tblShopProductImages.Find(id); if (tblShopProductImage == null) { return(NotFound()); } return(Ok(tblShopProductImage)); }
public IHttpActionResult PosttblShopProductImage(tblShopProductImage tblShopProductImage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tblShopProductImages.Add(tblShopProductImage); db.SaveChanges(); return(Ok(new { code = 0, data = "Image added successfully." })); }
public IHttpActionResult DeletetblShopProductImage(int id) { tblShopProductImage tblShopProductImage = db.tblShopProductImages.Find(id); if (tblShopProductImage == null) { return(NotFound()); } db.tblShopProductImages.Remove(tblShopProductImage); db.SaveChanges(); return(Ok(tblShopProductImage)); }