Пример #1
0
        public void UpdateLoanApplication_ShouldReturnIdOfUpdatedModel()
        {
            const int id      = 123;
            var       dbModel = LoanApplicationModelFactory.CreateBasicModelWithDecision().WithId(id);

            _fakeLoanApplicationContextFacade.LoanApplicationModels.Add(dbModel);
            var model      = LoanApplicationModelFactory.CreateBasicModel().WithId(id);
            var newModelId = _target.UpdateLoanApplication(model);

            newModelId.Should().Be(id);
        }
Пример #2
0
        public IActionResult Update([FromBody] LoanApplicationModel model)
        {
            if (model == null)
            {
                BadRequest();
            }

            // TODO: This should make sure all values are set (no null values)
            if (!ModelState.IsValid)
            {
                return(UnprocessableEntity());
            }
            var id = _loanApplicationLogic.UpdateLoanApplication(model);

            if (id < 0)
            {
                NotFound();
            }
            return(Ok(id));
        }