コード例 #1
0
 public virtual ActionResult Create()
 {
     var model = new CreateBudgetViewModel
     {
         Id = BudgetId.Create().ToString(),
         Name = "New Budget",
         Currencies = MyBudget.Domain.ValueObjects.Currencies.GetAll(),
     };
     return View(model);
 }
コード例 #2
0
        public virtual ActionResult Create(CreateBudgetViewModel model)
        {
            try
            {
                var handler = CommandManager.Create<CreateBudget>();
                handler(new CreateBudget
                {
                    UserId = GetCurrentUserId().ToString(),
                    BudgetName = model.Name,
                    BudgetId = BudgetId.Create().ToString(),
                    CurrencyISOCode = model.CurrencyISOCode,

                    Id = Guid.NewGuid(),
                    Timestamp = DateTime.Now,
                });

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }