public ActionResult Edit(Guid? id, ClientInput input) { if( !ModelState.IsValid ) { return View("Edit", input); } if( id.HasValue ) { var client = Session.Get<Client>(id.Value); client.Name = input.Name; } else { var client = new Client { Name = input.Name }; var project = Project.CreateStandardProject(client); Session.Save(client); Session.Save(project); } return RedirectToAction("List"); }
private Project(Client client, string name, bool standardProject, TaskStatus defaultTaskStatus) { Client = client; Sku = new UniqueSkuGenerator().Generate(); Name = name; StandardProject = standardProject; DefaultTaskStatus = defaultTaskStatus; }
public static Project CreateStandardProject(Client client) { return new Project(client, string.Empty, true, TaskStatus.Closed); }
public static Project CreateProject(Client client, string name) { return new Project(client, name, false, TaskStatus.Open); }