Ejemplo n.º 1
0
 public ActionResult OpenDeposit(int requestId, OpenDepositModel model)
 {
     var request = requestService.GetRequestDetails(requestId);
     if (request == null)
     {
         return new HttpNotFoundResult();
     }
     if (request.Type != RequestType.Deposit)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     if (ModelState.IsValidField("Amount") && model.Amount >= 1 && model.Amount <= 1000000000 && model.Amount - decimal.Round(model.Amount) == 0)
     {
         request.Amount = model.Amount;
         depositService.OpenDeposit(request);
         var deposit = depositService.FindByRequestId(requestId);
         if (deposit != null)
         {
             return RedirectToAction("EmployeeDetails", new {depositId = deposit.Id});
         }
         return RedirectToAction("Index", "Home");
     }
     model.RequestModel = request;
     ModelState.Clear();
     ModelState.AddModelError("", "Некорректное значение суммы");
     return View(model);
 }
Ejemplo n.º 2
0
 public ActionResult OpenDeposit(int requestId)
 {
     var request = requestService.GetRequestDetails(requestId);
     if (request == null)
     {
         return new HttpNotFoundResult();
     }
     if (request.Type != RequestType.Deposit)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     var model = new OpenDepositModel
     {
         RequestModel = request,
         Amount = request.Amount
     };
     return View(model);
 }