예제 #1
0
        public async Task <ActionResult <IEnumerable <Lead> > > GetAll()
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _logger.LogInformation("Getting All Leads.");
                    var response = await _dataAccessProvider.GetLeadRecords();

                    _logger.LogInformation("Operation Completed Succesfully.");
                    return(CreatedAtAction(nameof(GetAll), response));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong: {ex}");
                return(CreatedAtAction(nameof(GetAll), ex));
            }
        }