Пример #1
0
        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");
        }
Пример #2
0
 private Project(Client client, string name, bool standardProject, TaskStatus defaultTaskStatus)
 {
     Client = client;
     Sku = new UniqueSkuGenerator().Generate();
     Name = name;
     StandardProject = standardProject;
     DefaultTaskStatus = defaultTaskStatus;
 }
Пример #3
0
 public static Project CreateStandardProject(Client client)
 {
     return new Project(client, string.Empty, true, TaskStatus.Closed);
 }
Пример #4
0
 public static Project CreateProject(Client client, string name)
 {
     return new Project(client, name, false, TaskStatus.Open);
 }