/** Elimina uno stock * * Api Reference: GET /api/stocks/delete/<id>/ * * Requisiti: admin api_key negli header http */ public JsonResult Delete(int id) { ApiKey k = ApiKey.getApiKey(); ProductStock ps = Model.getById <ProductStock>(id); if (k.isAdmin() || ps.checkUserId(k.user_id)) { ps.delete(); return(Json(Costants.OK, JsonRequestBehavior.AllowGet)); } else { return(Json(Costants.UNAUTHORIZED, JsonRequestBehavior.AllowGet)); } }