public ActionResult CreateCredit(CreditViewModel model) { if (ModelState.IsValid) { decimal needAllocateAmount; var userId = User.Identity.GetUserId(); if (creditService.EnbleToCreateCredit(model, userId, out needAllocateAmount)) { model.UserId = userId; creditService.CreateCredit(model); creditService.AllocationCredit(model, model.UserId); TempData["CreditCreated"] = true; return(RedirectToAction("CreateCredit", "Home")); } else { ViewBag.CreditCreated = false; ViewBag.NeedAllocateAmount = needAllocateAmount; return(View("CreateCredit", model)); } } return(View("CreateCredit", model)); }