Example #1
0
 /**
  * This method is used for create a Product
  *
  * @url GET product/{ProductID}/{ClientID}/{LotID}/{MeasureID}/{CategoryID}/{Name}/{Quantity}
  */
 public function product($ProductID, $ClientID, $LotID, $MeasureID, $CategoryID, $Name, $Quantity)
 {
     $Utils = new Utils();
     $Client = new Client();
     $Lot = new Lot();
     $Measure = new Measure();
     $Category = new Category();
     $Product = new Product();
     if ($Client->findClient($ClientID) && $Lot->findLot($LotID) && $Measure->findMeasure($MeasureID) && $Category->findCategory($CategoryID) && $Product->findProduct($ProductID)) {
         $Product->Client_ID = $Client->Client_ID;
         $Product->Lot_ID = $Lot->Lot_ID;
         $Product->Category = $Category->Category_ID;
         $Product->Measure_ID = $Measure->Measure_ID;
         $Product->Name = $Name;
         $Product->Quantity = $Quantity;
         $productReturn = $Product->gravarDados();
         if ($productReturn) {
             return array('Success' => true, "Msg" => "Product has been alter", "Product_ID" => $productReturn);
         }
         return array('Success' => false, "Msg" => "Can't alter Product");
     }
     return array('Success' => false, "Msg" => "Client, Product or Measure not found");
 }