public async Task <ActionResult> Redirection(string shortUrl) { ShortLinkResponse slresponse = new ShortLinkResponse(); slresponse.OperationSucceded = false; if (!string.IsNullOrEmpty(shortUrl)) { var guestguid = CookieManager.TryAddCookie("VisitorNumber"); shortUrl = Server.HtmlEncode(shortUrl); WebAPIManager wamgr = new WebAPIManager(); string webapiaddress = ConfigurationManager.AppSettings["WebAPISite"]; slresponse = await wamgr.GetAsync(String.Format("{0}{1}/{2}", webapiaddress, shortUrl, guestguid)); } if (slresponse.OperationSucceded) { return(Redirect(slresponse.Link)); } else { return(View("Index")); } }
public DataSource() { _WAM = new WebAPIManager(); _Roles = new ObservableCollection<PersonRole>(); _Roles.Add(new PersonRole { RoleID = 1, Role = "Diák", GroupingOrder = 15 }); _Roles.Add(new PersonRole { RoleID = 2, Role = "Tanár", GroupingOrder = 10 }); _Roles.Add(new PersonRole { RoleID = 3, Role = "Admin", GroupingOrder = 5 }); _Roles.Add(new PersonRole { RoleID = 999, Role = "Saját", GroupingOrder = 0 }); }
/// <summary> /// 指定したクラスオブジェクトをJSON文字列に変換してPOSTする関数 /// </summary> /// <typeparam name="Type">POSTしたいクラスの型</typeparam> /// <param name="t">POSTしたいデータ</param> /// <param name="callback">callback関数</param> public static void JSONPost <Type>(Type t, OnCompleteJsonPost callback) { string jsonStr = JsonUtility.ToJson(t); WebAPIManager.APIPost(jsonStr, (string str) => { if (str == null) { callback(); } else { callback(); } }); }
/// <summary> /// GETして取得したJSON文字列を指定した型に変換する関数 /// </summary> /// <typeparam name="Type">取得したいクラス</typeparam> /// <param name="callback">取得クラスを使用するcallback関数</param> public static void JSONGet(APIType enumType, Dictionary <string, string> parameter, OnCompleteJsonGet callback) { string uri = ""; switch (enumType) { case APIType.user_create: uri = "users/create?"; break; case APIType.user_show: uri = "users/show?"; break; case APIType.user_update: uri = "users/update?"; break; case APIType.user_destroy: uri = "users/destroy?"; break; case APIType.position_add: uri = "positions/add?"; break; case APIType.position_destroy: uri = "positions/destroy?"; break; } uri += string.Join("&", parameter.Select(c => string.Format("{0}={1}", c.Key, c.Value)).ToArray()); WebAPIManager.APIGet(uri, (string jsonStr) => { if (jsonStr == null) { callback(null); } else { var jsonparse = Json.Deserialize(jsonStr) as Dictionary <string, object>; callback(jsonparse); } }); }
public ProductAPIController(WebAPIManager _apiManager) { this.apiManager = _apiManager; }
void Start() { webAPIManager = webObject.GetComponent <WebAPIManager>(); }
public StockClosingInfo GetStockClosingInfo(string id) { List <StockClosingInfo> list = (List <StockClosingInfo>)GetAllListFromTable(StockClosingInfo.TABLE_NAME, typeof(StockClosingInfo)); if (list == null || list.Find(x => x.ID == id) == null || (list.Find(x => x.ID == id).Date.ToString("yyyyMMdd") != DateTime.Today.ToString("yyyyMMdd") && DateTime.Now.Hour > 15)) { CompanyInfo company = ((List <CompanyInfo>)GetAllListFromTable(CompanyInfo.TABLE_NAME, typeof(CompanyInfo))).Find(x => x.ID == id); StockClosingInfo info = new StockClosingInfo(id, company.Nickname, WebAPIManager.GetStockClosingInfo(id)); InsertOrUpdateData(info); return(GetStockClosingInfo(id)); } else { return(list.Find(x => x.ID == id)); } }