public ActionResult Create()
        {
            var model = new CreditContractModel();

            InitializeModel(model);
            return View(model);
        }
 public ActionResult Save(CreditContractModel model)
 {
     if (ModelState.IsValid)
     {
         var dto = Mapper.Map<CreditContractDto>(model);
         var result = CommandBus.ExecuteCommand(new SaveCreditContractRequest { Value = dto });
         if (result.Success)
         {
             return RedirectToAction("Index");
         }
         ViewBag.Errors = "Ошибка вставки \n" + string.Join("\n", result.Errors.Select(x => x.Description));
     }
     InitializeModel(model);
     return View("Create", model);
 }
 private void InitializeModel(CreditContractModel model)
 {
     var clients = CommandBus.ExecuteCommand<IList<LookupItem>>(new ClientLookupListRequest());
     model.ClientsLookupItems = clients.TypedResult ?? new List<LookupItem>();
 }