public ActionResult CreateProject(ProjectVM project) { var mediator = new ProjectMediator(); var uMediator = new UserMediator(); if (string.IsNullOrWhiteSpace(project.DueDate)) { ViewBag.ControllerAction = "CreateProject"; ViewBag.PageTitle = "Create Project"; ModelState.AddModelError("ErrorMessage", "Please select a Due Date"); project.CompanyEmployees = uMediator.GetUsersByCompanyId(project.CompanyId); return(View("~/Views/Project/ProjectForm.cshtml", project)); } bool success = mediator.CreateProject(project); if (success) { return(Redirect("~/project/index")); } else { ViewBag.ControllerAction = "CreateProject"; ViewBag.PageTitle = "Create Project"; ModelState.AddModelError("ErrorMessage", "Unable to create project. Please verify input."); project.CompanyEmployees = uMediator.GetUsersByCompanyId(project.CompanyId); return(View("~/Views/Project/ProjectForm.cshtml", project)); } }
public ActionResult ProjectDetails(int id) { var model = new ProjectVM(); var mediator = new ProjectMediator(); model = mediator.GetProject(id); return(View("~/Views/Project/ProjectDetail.cshtml", model)); }
// // GET: /Project/ public ActionResult Index() { var mediator = new ProjectMediator(); CSUser user = SessionHelper.GetUserSession(); var projects = mediator.GetAllCompanyProjects(user.CompanyId); ViewBag.CompanyId = user.CompanyId; return(View(projects)); }
public ActionResult EditProject(int id) { var projectModel = new ProjectVM(); ViewBag.ControllerAction = "EditProject"; ViewBag.PageTitle = "Edit Project"; var mediator = new ProjectMediator(); var uMediator = new UserMediator(); projectModel = mediator.GetProject(id); projectModel.CompanyEmployees = uMediator.GetUsersByCompanyId(projectModel.CompanyId); return(View("~/Views/Project/ProjectForm.cshtml", projectModel)); }
static void Main(string[] args) { IHandler chefHandler = new ChefHandler("Adam Nowak"); IHandler analyticHandler = new AnalyticHandler("Andrzej Daniluk"); IHandler programmerHandler = new ProgrammerHandler("Mochi Per"); IHandler fronendHandler = new FrontendHandler("Marek Parowa"); chefHandler.SetNextHandler(analyticHandler); analyticHandler.SetNextHandler(programmerHandler); programmerHandler.SetNextHandler(fronendHandler); ProjectMediator mediator = new ProjectMediator(); chefHandler.Execute(mediator); mediator.ShowDevelopProgress(); }
public ActionResult EditProject(ProjectVM model) { var mediator = new ProjectMediator(); bool success = mediator.UpdateProject(model); if (success) { return(Redirect("/project/index")); } else { ModelState.AddModelError("ErrorMessage", "Unable to update project"); var uMediator = new UserMediator(); model.CompanyEmployees = uMediator.GetUsersByCompanyId(model.CompanyId); return(View("~/Views/Project/ProjectForm.cshtml", model)); } }