예제 #1
0
        public HttpResponseMessage BirthDayNotifications()
        {
            HttpResponseMessage httpResponse = new HttpResponseMessage();

            try
            {
                var Notifications = NotificationRepository.BirthdayNotifications();
                if (Notifications == null)
                {
                    httpResponse = Request.CreateResponse(HttpStatusCode.InternalServerError, "Error Occurred");
                }
                else
                {
                    httpResponse = Request.CreateResponse(HttpStatusCode.OK, Notifications);
                }
                return(httpResponse);
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = new StringContent("An error occurred, please try again or contact the administrator."),
                    ReasonPhrase = "An error occurred, please try again or contact the administrator.",
                    StatusCode   = HttpStatusCode.InternalServerError
                });
            }
        }