public int Add(string name, string description, string creator, bool isPrivate = false)
        {
            var currentUser = this.users
                .All()
                .FirstOrDefault(u => u.UserName == creator);

            var newProject = new SoftwareProject
            {
                Name = name,
                Description = description,
                Private = isPrivate,
                CreatedOn = DateTime.Now
            };

            newProject.Users.Add(currentUser);

            this.projects.Add(newProject);
            this.projects.SaveChanges();

            return newProject.Id;
        }
示例#2
0
        public int Add(string name, string description, string creator, bool isPrivate = false)
        {
            var currentUser = this.users
                              .All()
                              .FirstOrDefault(u => u.UserName == creator);

            var newProject = new SourceControlSystem.Models.SoftwareProject
            {
                Name        = name,
                Description = description,
                Private     = isPrivate,
                CreatedOn   = DateTime.Now
            };

            newProject.Users.Add(currentUser);

            this.projects.Add(newProject);
            this.projects.SaveChanges();

            return(newProject.Id);
        }