public RestApiResult GetProductInputByID(long id) { ProductInput productInput = ClarityDB.Instance.ProductInputs.FirstOrDefault(x => x.ID == id); if (productInput == null) { return(new RestApiResult { StatusCode = HttpStatusCode.NotFound }); } return(new RestApiResult { StatusCode = HttpStatusCode.OK, Json = productInput.ToJson() }); }
public RestApiResult Delete(long id) { ProductInput productInput = ClarityDB.Instance.ProductInputs.FirstOrDefault(x => x.ID == id); if (productInput == null) { return(new RestApiResult { StatusCode = HttpStatusCode.NotFound }); } UpdateInventoryAfterDeleteProductInput(productInput.ProductID, productInput.Quantity); ClarityDB.Instance.ProductInputs.Remove(productInput); ClarityDB.Instance.SaveChanges(); return(new RestApiResult { StatusCode = HttpStatusCode.OK, Json = productInput.ToJson() }); }