예제 #1
0
        public async Task <IHttpActionResult> PostErrorDetails([FromBody] ErrorDetails errorDetails)
        {
            var isNewError = await _errorRepository.AddErrorDetails(errorDetails);

            if (isNewError)
            {
                var contactEmail = await _programRepository.GetContactEmail(errorDetails.ProgramName);

                await _mailService.SendEmail("New error occured",
                                             $"{errorDetails.ExceptionDetails.ExceptionType} occured " +
                                             $"on {errorDetails.EnvironmentDetails.Version} version " +
                                             $"at {errorDetails.EnvironmentDetails.DateUtc}", contactEmail);
            }

            return(StatusCode(HttpStatusCode.Created));
        }