Ejemplo n.º 1
0
        public async Task <Project> AddProject(ProjectForManipulation project)
        {
            Project newProject = new Project {
                Name = project.Name, Description = project.Description
            };

            db.Projects.Add(newProject);
            await db.SaveChangesAsync();

            return(newProject);
        }
Ejemplo n.º 2
0
        public async Task <User> AddUser(UserForManipulation user)
        {
            User newUser = new User {
                UserName = user.UserName, FullName = user.FullName
            };

            db.Users.Add(newUser);
            await db.SaveChangesAsync();

            return(newUser);
        }
Ejemplo n.º 3
0
        public async Task <HoursRecord> AddAssignedHoursToUserForProject(HoursRecordForCreation hoursRecord)
        {
            HoursRecord record = new HoursRecord();

            record.User = await userService.FindUser(hoursRecord.UserId);

            record.Project = await projectService.FindProject(hoursRecord.ProjectId);

            record.AssignedHours = hoursRecord.Hours;
            db.HoursRecords.Add(record);
            await db.SaveChangesAsync();

            return(record);
        }