예제 #1
0
        public async Task <IActionResult> LendPost(LendingViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _interactor.Lend(model.BookId, model.LenderId, model.From, model.To);

                if (result.Success)
                {
                    return(RedirectToAction("Index"));
                }

                ModelState.AddOperationResultErrors(result.ErrorMessages);
            }

            model.Lenders = await GetLendersDropdown();

            return(View("Lend", model));
        }