public bool RegisterDeviceToken(RegisterDeviceTokenWebModel model)
        {
            int myAthleteID = new UserProfileLogic(db).GetAthleteIDForUserName(User.Identity.Name);

            new PushNotificationsLogic(db).RegisterDeviceToken(myAthleteID, model.Token, model.IsApple, model.IsAndroid, !model.IsNotProduction);
            return(true);
        }
Ejemplo n.º 2
0
        public async Task <bool> RegisterDeviceToken(string token, bool isApple, bool isAndroid)
        {
            string url = WebApiUrl + "PushNotifications/RegisterDeviceToken";

            try
            {
                RegisterDeviceTokenWebModel model = new RegisterDeviceTokenWebModel()
                {
                    Token           = token,
                    IsApple         = isApple,
                    IsAndroid       = isAndroid,
                    IsNotProduction = Config.IsProduction == false,
                };
                string responseJson = await this.sendPostRequestAndReceiveResponse(url, model, true);

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