Example #1
0
        public void Add(PlanAddModel model)
        {
            var plan = new Plan(model.Name, model.Price, model.Period, model.OrderIndex, model.PlanCode, true);

            _planRepository.Add(plan);
            _unitOfWork.Commit();
        }
Example #2
0
        public ActionResult Add(PlanAddModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            _planService.Add(model);

            return(RedirectToAction("index")
                   .AndAlert(AlertType.Success, "Success.", "Plan added successfully."));
        }
Example #3
0
        public void T02_Add()
        {
            var planModel = new PlanAddModel();

            Validate(planModel);
            Assert.AreEqual(3, Validate(planModel).Count, "Plans add validation is incorrect");

            planModel.Name       = "Small";
            planModel.Price      = 1699;
            planModel.Period     = "monthly";
            planModel.OrderIndex = 1;
            planModel.PlanCode   = "Small";
            planModel.Enabled    = true;

            var result = Controller.Add(planModel) as AlertResult <RedirectToRouteResult>;

            Assert.IsNotNull(result, "Plans add method work incorrect");
            Assert.AreEqual(result.Message.AlertType, AlertType.Success, "Plans add method return not success result");
        }