Beispiel #1
0
        public async Task <IActionResult> GetEmailAccountId(int id)
        {
            var Response = new SingleResponse <object>();

            try
            {
                if (!_IEmailAccountRepository.DoesEmailAccountExist(id))
                {
                    Response.DidError = true;
                    Response.Message  = $"The EmailAccount with the id: {id} was not found in the database.";
                    _Logger.LogError(ControllerContext, Response.Message);
                }
                else
                {
                    Response.Model = await _IEmailAccountRepository.GetEmailAccountByIdAsync(id);

                    Response.Message = $"Querying Account with the id: {id}.";
                    _Logger.LogInfo(ControllerContext, Response.Message);
                }
            }
            catch (Exception ex)
            {
                Response.DidError = true;
                Response.Message  = "Internal Server Error.";
                _Logger.LogError(ControllerContext, $"Error Message: {ex.Message}");
            }
            return(Response.ToHttpResponse());
        }