/** Aggiunge uno stock * * Api Reference: POST /api/stocks/ * * Requisiti: admin api_key negli header http * * JSON Data: {product_id:<id>, price:<pr>, min:<min>, max:<max>, availability:<av>} */ public JsonResult Index() { ApiKey k = ApiKey.getApiKey(); ProductStock s = ConvertibleHashtable.fromRequest().toObject <ProductStock>(); if (k.isAdmin() || s.checkUserId(k.user_id)) { s.insert(); return(Json(Costants.OK, JsonRequestBehavior.AllowGet)); } else { return(Json(Costants.UNAUTHORIZED, JsonRequestBehavior.AllowGet)); } }