Ejemplo n.º 1
0
 public ActionResult Create(CardFirstStepModel model)
 {
     if (ModelState.IsValid)
     {
         var cardModel = new CardModel
         {
             ClientId = model.ClientId
         };
         InitializeModel(cardModel);
         return View("Save", cardModel);
     }
     return View("Create", model);
 }
Ejemplo n.º 2
0
        public ActionResult Save(CardModel model)
        {
            if (ModelState.IsValid)
            {
                var dto = Mapper.Map<CardDto>(model);
                var result = CommandBus.ExecuteCommand(new SaveCardRequest { Value = dto });
                if (result.Success)
                {
                    return RedirectToAction("Index");
                }
                ViewBag.Errors = "Ошибка вставки \n" + string.Join("\n", result.Errors.Select(x => x.Description));

            }
            InitializeModel(model);
            return View("Save", model);
        }
Ejemplo n.º 3
0
 private void InitializeModel(CardModel model)
 {
     var accounts = CommandBus.ExecuteCommand<IList<LookupItem>>(new AccountLookupListRequest {Value = model.ClientId});
     model.AccountLookupItems = accounts.TypedResult ?? new List<LookupItem>();
 }