public bool EditProductStatus(Product_Status productStatus) { var pS = _productStatusRepository.GetById(productStatus.ID); if (pS != null) { _productStatusRepository.Update(productStatus); return true; } return false; }
public IHttpActionResult PostProduct_Status(Product_Status product_status) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _productStatusService.AddProductStatus(product_status); return CreatedAtRoute("DefaultApi", new { id = product_status.ID }, product_status); }
public bool AddProductStatus(Product_Status productStatus) { try { _productStatusRepository.Add(productStatus); return true; } catch (Exception) { return false; } }
// PUT api/ProductStatus/5 public IHttpActionResult PutProduct_Status(int id, Product_Status product_status) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != product_status.ID) { return BadRequest(); } _productStatusService.EditProductStatus(product_status); return StatusCode(HttpStatusCode.NoContent); }