예제 #1
0
        public bool DeviceInfo(DeviceInfoWebModel info)
        {
            var me = new UserProfileLogic(db).GetAthleteForUserName(this.User.Identity.Name);

            db.DeviceInfos.Add(new Awpbs.DeviceInfo()
            {
                AthleteID   = me.AthleteID,
                TimeCreated = DateTime.UtcNow,
                Platform    = info.Platform,
                OSVersion   = info.OSVersion,
            });
            db.SaveChanges();

            return(true);
        }
예제 #2
0
        public async Task <bool> SendDeviceInfo()
        {
            string url = WebApiUrl + "About/DeviceInfo";

            try
            {
                DeviceInfoWebModel model = new DeviceInfoWebModel()
                {
                    Platform  = (int)(Config.IsAndroid ? MobilePlatformEnum.Android : MobilePlatformEnum.IOS),
                    OSVersion = Config.OSVersion ?? "unknown",
                    OtherInfo = "app version: " + SnookerBybMobileVersions.Current.ToString(),
                };
                string responseJson = await sendPostRequestAndReceiveResponse(url, model, true);

                bool response = JsonConvert.DeserializeObject <bool>(responseJson);
                return(response);
            }
            catch (Exception exc)
            {
                LastException    = exc;
                LastExceptionUrl = url;
                return(false);
            }
        }