Exemple #1
0
        public async Task <IActionResult> RegisterForNotifications(NotificationRequestBody requestBody)
        {
            // Load the timezone for the selected location
            var timeZone = await LocationService.GetTimeZone(requestBody.Latitude, requestBody.Longitude);

            // Parse the request body into the correct model
            var notificationRequest = requestBody.ToNotificationRequest(timeZone);

            try
            {
                await NotificationService.AddNotificationRequest(notificationRequest);
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }

            return(Ok());
        }