public UpdatePlan(PlanFormViewModel planFormViewModel, string id, string token, IPlanRepository planRepo) { _id = id; _token = token; PlanFormViewModel = planFormViewModel; PlanRepo = planRepo; }
public IActionResult Index(PlanFormViewModel planFormVm) { var resultVm = new CreatePlanIntegrator(planFormVm, _planRepo).Run(); if (resultVm is SuccessViewModel successViewModel) { successViewModel.SuccessActionName = "created"; return(RedirectToAction("Success", "Plan", successViewModel)); } // ERROR Handling return(View("Error", resultVm)); }
public IActionResult Edit(string id, string token, PlanFormViewModel planFormVm) { // Demo Plan Case if (id == "cVJ58vGy344MnRwc2vO0Z8lR1C669W1V") { return(RedirectToAction("Success", "Plan", new SuccessViewModel { Id = "cVJ58vGy344MnRwc2vO0Z8lR1C669W1V", Token = "2vO0Z8lR1C669W1VcVJ58vGy344MnRwc", SuccessActionName = "changed" })); } // Normal Case var resultVm = new UpdatePlan(planFormVm, id, token, _planRepo).Run(); if (resultVm is SuccessViewModel successViewModel) { successViewModel.SuccessActionName = "changed"; return(RedirectToAction("Success", "Plan", successViewModel)); } // ERROR Handling return(View("Error", resultVm)); }
public CreatePlanIntegrator(PlanFormViewModel planFormViewModel, IPlanRepository planRepo) { PlanFormViewModel = planFormViewModel; PlanRepo = planRepo; // BAD: Dependency hiding!!! }