示例#1
0
        public async Task <ActionResult> changeNotificationSetting(ChangeNotificationsSettingsRequest request)
        {
            if (request.username == null)
            {
                return(BadRequest("A username is needed to update settings."));
            }

            if (request.email == null)
            {
                return(BadRequest("An email preference is needed to update settings."));
            }

            if (request.push == null)
            {
                return(BadRequest("A push preference is needed to update settings."));
            }

            bool changed = await notificationSettingsRepository.changeSetting(request.username, request.email, request.push);

            if (changed)
            {
                return(Ok("Changed your settings successfully."));
            }
            else
            {
                return(StatusCode(500, "We were unable to save your settings right now."));
            }
        }
示例#2
0
        public async Task <ActionResult> changeNotificationSetting(ChangeNotificationsSettingsRequest request)
        {
            bool changed = await notificationSettingsRepository.changeSetting(request.username, request.email, request.push);

            if (changed)
            {
                return(Ok("Changed your settings successfully."));
            }
            else
            {
                return(StatusCode(500, "We were unable to save your settings right now."));
            }
        }