Ejemplo n.º 1
0
        public async Task <IActionResult> Index(string Id)
        {
            await _emailer.sendEmail("*****@*****.**", "Welcome to decagon", "Decagon welcomes you");

            if (!string.IsNullOrWhiteSpace(Id))
            {
                var user = await _userMgr.FindByIdAsync(Id);

                ViewBag.UserName = user.UserName;
            }

            var categories = await _loanCategoryRepository.GetAllLoanCategories();

            var loanCompanies = await _companyRepository.GetAllLoanCompanies();

            var listOfCategoriesViewModel           = new List <LoanCategoryViewModel>();
            var listOfLoanCompaniesDetailsViewModel = new List <LoanCompanyDetailsViewModel>();

            foreach (var item in categories)
            {
                var categoryViewModel = new LoanCategoryViewModel()
                {
                    CategoryName = item.CategoryName,
                    Id           = item.Id
                };
                listOfCategoriesViewModel.Add(categoryViewModel);
            }

            foreach (var item in loanCompanies)
            {
                var loanCompanyVM = new LoanCompanyDetailsViewModel()
                {
                    CompanyDescription = item.Description,
                    CompanyName        = item.CompanyName,
                    Id = item.Id
                };
                listOfLoanCompaniesDetailsViewModel.Add(loanCompanyVM);
            }

            var g = new IndexModel {
                details = listOfLoanCompaniesDetailsViewModel, categories = listOfCategoriesViewModel
            };

            return(View(g));
        }
        public async Task <IActionResult> Index()
        {
            var loanCompanies = await _loanCompanyRepository.GetAllLoanCompanies();

            var listOfLoanCompanyViewModels = new List <LoanCompanyViewModel>();

            foreach (var item in loanCompanies)
            {
                var viewModel = new LoanCompanyViewModel()
                {
                    Id          = item.Id,
                    Description = item.Description,
                    CompanyLogo = item.CompanyLogo,
                    CompanyName = item.CompanyName
                };
                listOfLoanCompanyViewModels.Add(viewModel);
            }
            return(View(listOfLoanCompanyViewModels));
        }
Ejemplo n.º 3
0
        // GET: LoanCompany/Create
        public async Task <IActionResult> AddOrEdit(string id = "")
        {
            var viewModel = new LoanViewModel();

            if (id != "")
            {
                var model = await _loanRepository.GetLoan(id);

                viewModel.LoanCompany   = model.LoanCompany;
                viewModel.LoanCategory  = model.LoanCategory;
                viewModel.Id            = model.Id;
                viewModel.InterestRate  = model.InterestRate;
                viewModel.MaximumAmount = model.MaximumAmount;
                viewModel.MinimumAmount = model.MinimumAmount;
                viewModel.Moratorium    = model.Moratorium;
            }

            ViewBag.loanCategories = await _loanCategoryRepository.GetAllLoanCategories();

            ViewBag.loanCompanies = await _loanCompanyRepository.GetAllLoanCompanies();

            return(View(viewModel));
        }