예제 #1
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 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);
        }