public async Task <IActionResult> GetAll()
        {
            _logger.LogInformation("Getting all companies");
            try
            {
                var companies = await _companiesService.GetCompanies();

                return(Ok(_mapper.Map <ICollection <Company> >(companies)));
            }
            catch (Exception ex)
            {
                _logger.LogError($"{_localizer["Failed to get all companies"]}", ex);
                return(BadRequest());
            }
        }
Exemplo n.º 2
0
 void LoadCompaniesAndTypes()
 {
     if (Companies == null || Types == null)
     {
         Companies = _companiesService.GetCompanies();
         Types     = _typesService.GetTypes();
     }
 }
 public ResultsVM GetCompanies()
 {
     try
     {
         var companies = _companiesService.GetCompanies();
         return(new ResultsVM(companies, StatusCodes.Success, null));
     }
     catch (Exception ex)
     {
         return(new ResultsVM(null, StatusCodes.InternalServerError, "Error in getting companies list"));
     }
 }
 public ActionResult <IEnumerable <CompanyModel> > GetCompanies(string orderBy = "Id")
 {
     try
     {
         return(Ok(_companyService.GetCompanies(orderBy)));
     }
     catch (BadRequestOperationException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception ex)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, $"Something happend: {ex.Message}"));
     }
 }
        public async Task <IActionResult> Get([FromQuery] Query query = null)
        {
            _logger.LogInformation("Getting companies");
            try
            {
                var pageOfCompanies = await _dashboardService.GetCompanies(query);

                return(Ok(pageOfCompanies));
            }
            catch (Exception ex)
            {
                _logger.LogError($"{_localizer["Failed to get companies"]}" + ex);
                return(BadRequest());
            }
        }
Exemplo n.º 6
0
 public override void OnNavigatedTo(NavigationContext navigationContext)
 {
     Companies = _companiesService.GetCompanies();
     Types     = _typesService.GetTypes();
     Account   = GetAccount(navigationContext);
     if (Account != null)
     {
         AccountsTabItemHeader  = "Ред. информации по сч. " + Account.AccountNumber;
         IsAdditinalInfoEnabled = true;
     }
     else
     {
         AccountsTabItemHeader = "Новый счет";
         Account = new AccountsMainSet
         {
             AccountYear = DateTime.Now.Year,
             AccountDate = DateTime.Now
         };
         IsAdditinalInfoEnabled = false;
         IsInEditMode           = true;
         AvailableSum           = 0M;
     }
     _worker.RunWorkerAsync();
 }
Exemplo n.º 7
0
 public async Task <IHttpActionResult> GetCompanies()
 {
     return(await GetMyResult(() => _companiesService.GetCompanies()));
 }
Exemplo n.º 8
0
 public async Task <IEnumerable <ICompany> > GetCompanies()
 {
     return(await _companiesService.GetCompanies());
 }