Пример #1
0
 internal async Task PostModelAsync(string url, Models.RequestModel model, string accessToken = null, ApiVersion api = ApiVersion.v5, string clientId = null)
 {
     await _rateLimiter.Perform(async() =>
     {
         await GeneralRequestAsync(url, HttpMethod.Post, _jsonSerializer.SerializeObject(model), accessToken, api, clientId);
     });
 }
Пример #2
0
        /// <summary>
        /// 已读
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public IHttpActionResult Read([FromBody] Models.RequestModel req)
        {
            try
            {
                using (dbDataContext db = new dbDataContext())
                {
                    var parameters = Common.AesDecryp.GetAesDecryp(req.data, req.secret);
                    var BusID      = Convert.ToInt32(parameters["BusID"]);//商机提醒ID

                    var bus = db.Business.Where(x => x.ID == BusID).FirstOrDefault();
                    if (bus != null)
                    {
                        bus.IsRead = 1;//已读

                        db.SubmitChanges();

                        return(Json(new { stata = 1, msg = "请求成功" }));
                    }

                    return(Json(new { stata = 0, msg = "商机不存在" }));
                }
            }
            catch (Exception ex)
            {
                //return Json(new { state = 0, msg = "请求失败" });
                throw ex;
            }
        }
Пример #3
0
        public ActionResult SendRequestToTutor()
        {
            var model = new Models.RequestModel()
            {
            };

            return(View(model));
        }
Пример #4
0
        public ActionResult SendRequestToTutor(Models.RequestModel model)
        {
            var student = BLL.Data.StudentData.GetStudent(((CustomPrincipal)User).UserId);

            try
            {
                var res = BLL.Data.StudentData.SendRequest(new BLL.DTO.RequestDTO
                {
                    studentId    = student.id,
                    lessonTypeId = model.lessonTypeId,
                    info         = model.info,
                    status       = "",
                    subjectId    = model.subjectId,
                    date         = DateTime.Now,
                    tutorId      = model.tutorId
                });
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }

            return(Json(new { success = true }));
        }
Пример #5
0
        internal Task <T> TwitchPostGenericModelAsync <T>(string resource, ApiVersion api, Models.RequestModel model, string accessToken = null, string clientId = null, string customBase = null)
        {
            string url = ConstructResourceUrl(resource, api: api, overrideUrl: customBase);

            if (string.IsNullOrEmpty(clientId) && !string.IsNullOrEmpty(Settings.ClientId))
            {
                clientId = Settings.ClientId;
            }
            if (string.IsNullOrEmpty(accessToken) && !string.IsNullOrEmpty(Settings.AccessToken))
            {
                accessToken = Settings.AccessToken;
            }

            return(_rateLimiter.Perform(async() => await Task.Run(() => JsonConvert.DeserializeObject <T>(_http.GeneralRequest(url, "POST", model != null ? _jsonSerializer.SerializeObject(model) : "", api, clientId, accessToken).Value, _twitchLibJsonDeserializer)).ConfigureAwait(false)));
        }
Пример #6
0
 internal async Task <T> PostGenericModelAsync <T>(string url, Models.RequestModel model, string accessToken = null, ApiVersion api = ApiVersion.v5, string clientId = null)
 {
     return(await _rateLimiter.Perform(async() => JsonConvert.DeserializeObject <T>(model != null
         ? (await GeneralRequestAsync(url, HttpMethod.Post, _jsonSerializer.SerializeObject(model), accessToken, api, clientId)).Value
         : (await GeneralRequestAsync(url, HttpMethod.Post, "", accessToken, api)).Value, _twitchLibJsonDeserializer)));
 }
Пример #7
0
        internal Task <T> TwitchPostGenericModelAsync <T>(string resource, ApiVersion api, Models.RequestModel model, string accessToken = null, string clientId = null, string customBase = null)
        {
            string url = ConstructResourceUrl(resource, api: api, overrideUrl: customBase);

            return(_rateLimiter.Perform(async() => JsonConvert.DeserializeObject <T>(model != null
                ? (await GeneralRequestAsync(url, HttpMethod.Post, _jsonSerializer.SerializeObject(model), accessToken, api, clientId)).Value
                : (await GeneralRequestAsync(url, HttpMethod.Post, "", accessToken, api)).Value, _twitchLibJsonDeserializer)));
        }