// GET: Opportunities/Details/5
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OpportunityViewModel opportunity = Mapper.Map <OpportunityViewModel>(opportunityService.Get(id.Value));

            if (opportunity == null)
            {
                return(HttpNotFound());
            }
            return(View(opportunity));
        }
 public IActionResult Get()
 {
     try
     {
         _logger.LogInformation("Trying to get list of opportunities");
         var opportunities = _opportunitiesService.Get().ToList();
         _logger.LogInformation($"Search completed. Found {opportunities.Count} records.");
         OpportunityResponse.NumberOfRecordsFound = opportunities.Count;
         OpportunityResponse.Message = "Search completed.";
         OpportunityResponse.Data    = opportunities;
         return(Ok(new[] { OpportunityResponse }));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Error: {ex.Message}");
     }
     _logger.LogError("Bad request");
     return(BadRequest());
 }
        public IActionResult Get(string id)
        {
            var result = _opportunityService.Get(id);

            if (result != null)
            {
                return(Ok(result));
            }

            return(NotFound(new { message = $"Your ID '{id}' was NOT found." }));
        }