Beispiel #1
0
        public void LoanIntegration_Add_ShouldBeOk()
        {
            _book = ObjectMother.GetBook();
            _loan = ObjectMother.GetLoanSQL(_book);

            _expectedLoan = _service.Add(_loan);

            _expectedLoan.Should().NotBeNull();
            _expectedLoan.Id.Should().Be(2);
        }
Beispiel #2
0
        public void LoanSqlRepository_Save_ShouldBeOk()
        {
            //Cenário
            Loan loan = ObjectMother.GetLoan();

            loan.Book = _book;

            //Executa
            Loan result = _service.Add(loan);

            //Saída
            result.Id.Should().BeGreaterThan(0);
        }
Beispiel #3
0
        public void LoanService_Add_ShouldBeOk()
        {
            _book.Object.Id           = 1;
            _book.Object.Availability = true;
            _loan = ObjectMother.GetLoan(_book.Object);
            _repository.Setup(rp => rp.Add(_loan)).Returns(_loan);

            _expectedLoan = _service.Add(_loan);

            _expectedLoan.Should().NotBeNull();
            _expectedLoan.Id.Should().Be(1);
            _repository.Verify(rp => rp.Add(_loan));
        }
        public ActionResult Index(LoanInfo item, string LoanType)
        {
            //LoanInfo item


            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                item.LoanType = LoanType;

                _logger.Info(item.LoanType);
                _db.Add(item);

                Session["item"] = item;
            }
            catch (Exception e)
            {
                //Logger logger = LogManager.GetLogger("fileLogger");

                // add custom message and pass in the exception
                _logger.Error(e, "Whoops!");
            }
            return(RedirectToAction("FilteredResult", "Loan"));
        }
Beispiel #5
0
 public IActionResult Create(Loan loan)
 {
     if (ModelState.IsValid)
     {
         _loanService.Add(loan);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(loan));
 }
        public async Task <int> SaveBorrower([FromBody] LoanDTO loanInfo)
        {
            int loanId = 0;

            try
            {
                loanId = await _loanService.Add(loanInfo);
            }
            catch (Exception ex)
            {
                using (_logger.BeginScope(new Dictionary <string, object> {
                    { "Loan", "SaveLoan" }
                }))
                {
                    _logger.LogError(ex.Message);
                }
                throw ex;
            }
            return(loanId);
        }
        public async Task <ActionResult <Result> > Create(Loan loan)
        {
            var result = await _loanService.Add(new Loan
            {
                Id              = Guid.NewGuid().ToString(),
                Name            = loan.Name,
                BankId          = loan.BankId,
                BorrowerId      = loan.BorrowerId,
                OriginalAmount  = loan.OriginalAmount,
                OriginalTenure  = loan.OriginalTenure,
                PropertyId      = loan.PropertyId,
                CreatedUsername = loan.CreatedUsername,
                CreatedOn       = DateTime.Now,
                UpdatedUsername = null,
                UpdatedOn       = default(DateTime),
                Comments        = "Loan Entity Creation"
            });

            return(Ok(result));
        }
Beispiel #8
0
        public IResponse Execute(string[] args)
        {
            var bankName     = args[0];
            var borrowerName = args[1];
            var principal    = int.Parse(args[2]);
            var noOfYears    = int.Parse(args[3]);
            var interestRate = int.Parse(args[4]);

            var loan = new Loan()
            {
                BankName     = bankName,
                BorrowerName = borrowerName,
                Principal    = principal,
                NoOfYears    = noOfYears,
                InterestRate = interestRate
            };

            loanService.Add(loan);
            return(null);
        }