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);
 }
Example #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));
        }
Example #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());
            }
        }
        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();
            }
        }
Example #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());
        }
        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();
        }