예제 #1
0
 public ActionResult CreateCreditRequest(CreditRequestVM model)
 {
     var validModel = true;
     ModelState.Clear();
     if (!ModelState.IsValidField("Amount") || model.RequestModel.Amount < 1 ||
         model.RequestModel.Amount > 1000000000)
     {
         validModel = false;
         ModelState.AddModelError("", "Некорректное значение суммы");
     }
     if (!ModelState.IsValidField("MonthIncome") || model.RequestModel.MonthIncome < 1 ||
         model.RequestModel.MonthIncome > 1000000000)
     {
         validModel = false;
         ModelState.AddModelError("", "Некорректное значение дохода");
     }
     model.CreditTypes = GetCreditTypesListItems();
     if (!validModel)
     {
         model.RequestModel.MonthIncome = 0;
         return View(model);
     }
     model.RequestModel.ClientId = CurrentUser.UserId;
     model.RequestModel.State = RequestState.Pending;
     model.RequestModel.Type = RequestType.Credit;
     requestService.CreateRequest(model.RequestModel);
     return RedirectToAction("ClientViewRequests");
 }
예제 #2
0
 public ActionResult CreateCreditRequest()
 {
     var creditRequestModel = new CreditRequestVM
     {
         CreditTypes = GetCreditTypesListItems(),
         RequestModel = new RequestModel()
     };
     var firstCreditType = creditRequestModel.CreditTypes.FirstOrDefault();
     if (firstCreditType != null)
     {
         firstCreditType.Selected = true;
     }
     creditRequestModel.RequestModel.MonthIncome = 0;
     return View(creditRequestModel);
 }