コード例 #1
0
 public virtual ActionResult Create(string budgetId, string returnUrl)
 {
     var budget = ProjectionManager.GetBudgetsList().GetBudgetById(new MyBudget.Domain.Budgets.BudgetId(budgetId));
     var model = new DistributionKeyViewModel
     {
         BudgetId = budgetId,
         BudgetName = budget.Name,
         Name = "New DistributionKey",
         ReturnUrl = returnUrl,
     };
     return View(model);
 }
コード例 #2
0
        public virtual ActionResult Create(string budgetId, string returnUrl)
        {
            var budget = ProjectionManager.GetBudgetsList().GetBudgetById(new MyBudget.Domain.Budgets.BudgetId(budgetId));
            var model  = new DistributionKeyViewModel
            {
                BudgetId   = budgetId,
                BudgetName = budget.Name,
                Name       = "New DistributionKey",
                ReturnUrl  = returnUrl,
            };

            return(View(model));
        }
コード例 #3
0
        public virtual ActionResult Create(DistributionKeyViewModel model)
        {
            try
            {
                var handler = CommandManager.Create <AddBudgetDistributionKey>();
                handler(new AddBudgetDistributionKey
                {
                    UserId   = GetCurrentUserId().ToString(),
                    BudgetId = model.BudgetId,
                    Name     = model.Name,

                    Id        = Guid.NewGuid(),
                    Timestamp = DateTime.Now,
                });
                return(Redirect(model.ReturnUrl));
            }
            catch
            {
                return(View());
            }
        }
コード例 #4
0
        public virtual ActionResult Create(DistributionKeyViewModel model)
        {
            try
            {
                var handler = CommandManager.Create<AddBudgetDistributionKey>();
                handler(new AddBudgetDistributionKey
                {
                    UserId = GetCurrentUserId().ToString(),
                    BudgetId = model.BudgetId,
                    Name = model.Name,

                    Id = Guid.NewGuid(),
                    Timestamp = DateTime.Now,
                });
                return Redirect(model.ReturnUrl);
            }
            catch
            {
                return View();
            }
        }
コード例 #5
0
        public virtual ActionResult Edit(DistributionKeyViewModel model)
        {
            //try
            //{
            //    var handler = CommandManager.Create<UpdateCategory>();
            //    handler(new UpdateCategory
            //    {
            //        UserId = GetCurrentUserId().ToString(),
            //        CategoryName = model.Name,
            //        CategoryDescription = model.Description,
            //        CategoryId = model.Id,

            //        Id = Guid.NewGuid(),
            //        Timestamp = DateTime.Now,
            //    });
            //    return RedirectToAction(Actions.Index(model.BudgetId));
            //}
            //catch
            //{
            //    return View();
            //}
            return(View());
        }
コード例 #6
0
        public virtual ActionResult Edit(DistributionKeyViewModel model)
        {
            //try
            //{
            //    var handler = CommandManager.Create<UpdateCategory>();
            //    handler(new UpdateCategory
            //    {
            //        UserId = GetCurrentUserId().ToString(),
            //        CategoryName = model.Name,
            //        CategoryDescription = model.Description,
            //        CategoryId = model.Id,

            //        Id = Guid.NewGuid(),
            //        Timestamp = DateTime.Now,
            //    });
            //    return RedirectToAction(Actions.Index(model.BudgetId));
            //}
            //catch
            //{
            //    return View();
            //}
            return View();
        }