public ActionResult UpdateApplication()
        {
            UpdateAppModel model = new UpdateAppModel();

            model.Apps = new AppRepository().GetAll();
            return(View(model));
        }
Пример #2
0
        public ActionResult UpdateApp()
        {
            UpdateAppModel uModel = new UpdateAppModel();

            if (this.RouteData.Values.ContainsKey("id"))
            {
                string param = this.RouteData.Values["id"].ToString();
                uModel.id   = param.Split('$')[0];
                uModel.name = param.Split('$')[1];
                return(View(uModel));
            }
            else
            {
                return(View());
            }
        }
Пример #3
0
        /// <summary>
        /// 更新这个App的信息。
        /// </summary>
        /// <param name="model">更新App模型。</param>
        public void UpdateInfo(UpdateAppModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            var text = model.ToString();

            if (string.IsNullOrWhiteSpace(text))
            {
                return;
            }
            using (var webClient = WebClientHelper.GetWebClient())
            {
                webClient.Headers["Content-Type"] = "application/x-www-form-urlencoded";
                var address = string.Format("http://fir.im/api/v2/app/{0}?token={1}", _appToken, _userToken);
                var bytes   = webClient.UploadData(address, "PUT", Encoding.UTF8.GetBytes(text));
                Console.WriteLine(Encoding.UTF8.GetString(bytes));
            }
        }