public IHttpActionResult Put([FromUri] int id, [FromBody] DistributedProduct product) { if (product == null) { return(StatusCode(HttpStatusCode.NoContent)); } product.DistributedProductId = id; if (ModelState.IsValid) { DistributedProductRepository distributedProductRepository = new DistributedProductRepository(); distributedProductRepository.Update(product); return(Ok(product)); } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Post(DistributedProduct distributedProduct) { if (distributedProduct == null) { return(StatusCode(HttpStatusCode.NoContent)); } distributedProduct.Status = 1; if (ModelState.IsValid) { DistributedProductRepository productRepository = new DistributedProductRepository(); productRepository.Insert(distributedProduct); return(Created("abc", distributedProduct)); } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult ChangeProductStatusInBranch(int id) { DistributedProductRepository distributedProductId = new DistributedProductRepository(); DistributedProduct distributedProduct = distributedProductId.Get(id); if (distributedProduct.Status == 1) { distributedProduct.Status = 0; distributedProductId.Update(distributedProduct); } else { distributedProduct.Status = 1; distributedProductId.Update(distributedProduct); } return(Ok(distributedProduct)); }