public async Task <IActionResult> AddOrEdit(LoanCompanyUploadViewModel loanCompanyUploadView)
        {
            if (ModelState.IsValid)
            {
                string uniquePhotoFileName = null;
                string uploadsFolder       = Path.Combine(_webHostEnvironment.WebRootPath, "images");
                uniquePhotoFileName = Guid.NewGuid().ToString() + "_" + loanCompanyUploadView.CompanyLogo.FileName;
                string filePath = Path.Combine(uploadsFolder, uniquePhotoFileName);

                await loanCompanyUploadView.CompanyLogo.CopyToAsync(new FileStream(filePath, FileMode.Create));

                if (loanCompanyUploadView.Id == null)
                {
                    var loanCompany = new LoanCompany()
                    {
                        Description = loanCompanyUploadView.Description,
                        CompanyLogo = uniquePhotoFileName,
                        CompanyName = loanCompanyUploadView.CompanyName
                    };
                    await _loanCompanyRepository.AddLoanCompany(loanCompany);
                }

                else
                {
                    var loanCompany = await _loanCompanyRepository.GetLoanCompany(loanCompanyUploadView.Id);

                    loanCompany.Description = loanCompanyUploadView.Description;
                    loanCompany.CompanyLogo = uniquePhotoFileName;
                    loanCompany.CompanyName = loanCompanyUploadView.CompanyName;
                    await _loanCompanyRepository.UpdateLoanCompany(loanCompany);
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(loanCompanyUploadView));
        }
        // GET: LoanCompany/Create
        public async Task <IActionResult> AddOrEdit(string id = "")
        {
            var viewModel = new LoanCompanyUploadViewModel();

            if (id != "")
            {
                var model = await _loanCompanyRepository.GetLoanCompany(id);

                viewModel.CompanyName = model.CompanyName;
                viewModel.Id          = model.Id;
                viewModel.Description = model.Description;
            }
            return(View(viewModel));
        }