public ActionResult Create(long id) { var loanApplication = _controleHelper.FirstOrDefault<LoanApplication>(l => l.Id == id, null, l => l.Loan, l => l.SystemResolutions, l => l.SystemResolutions.Select(s => s.EstimatesWeight)); var ExpertResolution = new ExpertResolutionViewModel(); ExpertResolution.LoanGuarantee = loanApplication.Loan.LoanGuarantee; ExpertResolution.LoanApplicationId = id; return View(ExpertResolution); }
public ActionResult Create(ExpertResolutionViewModel model) { try { if (!ModelState.IsValid) { return View(model); } var result = _controleHelper.CreateEntity<ExpertResolution, ExpertResolutionViewModel>(model); if (result.Error.Any()) { ModelState.AddModelError(string.Empty, result.Error.First().ErrorMessage); return View(model); } return RedirectToAction("Details", new { id = result.Entity.LoanApplicationId }); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); return View(model); } }