コード例 #1
0
 public bool EditProductStatus(Product_Status productStatus)
 {
     var pS = _productStatusRepository.GetById(productStatus.ID);
     if (pS != null)
     {
         _productStatusRepository.Update(productStatus);
         return true;
     }
     return false;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public bool AddProductStatus(Product_Status productStatus)
 {
     try
     {
         _productStatusRepository.Add(productStatus);
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
コード例 #4
0
        // 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);
        }