public JsonResult Index() { ConvertibleHashtable h = ConvertibleHashtable.fromRequest(); ConvertibleHashtable ud = ConvertibleHashtable.fromJObject((JObject)h["user_data"]); ApiKey k = ApiKey.getApiKey(); if (k.isAdmin()) { if (h["type"].ToString() == "supplier") { ud.merge(((JObject)h["supplier_data"]).ToObject <ConvertibleHashtable>()); if (ud.ContainsKey("user_id")) { ud.Remove("user_id"); } ud.toObject <Supplier>().insert(); } else if (h["type"].ToString() == "admin") { ud.toObject <Admin>().insert(); } else { return(Json(Costants.WRONG_USER_TYPE, JsonRequestBehavior.AllowGet)); } return(Json(Costants.OK, JsonRequestBehavior.AllowGet)); } else { return(Json(Costants.UNAUTHORIZED, JsonRequestBehavior.AllowGet)); } }