[HttpPut("update/{id}")]//http://localhost:5000/WishList_Productss/update/2 public async Task <IActionResult> UpdateWishList_Products(WishList_ProductsModel wishList_products, long id) { try { if (id != wishList_products.IdWishList_Products) { return(BadRequest()); } dBContext.Entry(wishList_products).State = EntityState.Modified; await dBContext.SaveChangesAsync(); return(NoContent()); } catch (Exception e) { bool wishList_productsExist = dBContext.WishLists_Products.Any(e => e.IdWishList_Products == id); if (!wishList_productsExist) { return(NotFound()); } return(StatusCode(410)); } }
[HttpPost("create")]//http://localhost:5000/WishList_Productss/create public async Task <ActionResult <WishList_ProductsModel> > PostWishList_Products(WishList_ProductsModel wishList_products) { try { dBContext.WishLists_Products.Add(wishList_products); await dBContext.SaveChangesAsync(); return(Ok(wishList_products)); } catch (Exception e) { return(StatusCode(410)); } }