Beispiel #1
0
        public async Task <IEnumerable <ProjectDTO> > Create(ProjectDTO projectDTO)
        {
            Project project = CreateByMapper.CreateProjectByMapper(projectDTO);
            await database.Projects.Create(project);

            await database.Save();

            IEnumerable <Project> projects = database.Projects.Find(p =>
                                                                    p.Name == project.Name &&
                                                                    p.Customer == project.Customer &&
                                                                    p.Priority == project.Priority &&
                                                                    p.Performer == project.Performer &&
                                                                    p.StartDate == project.StartDate &&
                                                                    p.FinishDate == project.FinishDate &&
                                                                    p.LeadId == project.LeadId
                                                                    );

            if (projects == null)
            {
                return(null);
            }
            IEnumerable <ProjectDTO> projectDTOs = CreateByMapper.CreateProjectDTOByMapper(projects);

            return(projectDTOs);
        }
        public async Task Edit(ProjectsEmployeesDTO source, ProjectsEmployeesDTO dest)
        {
            await database.ProjectsEmployees
            .Update(CreateByMapper.CreateProjectEmployeeByMapper(source),
                    CreateByMapper.CreateProjectEmployeeByMapper(dest));

            await database.Save();
        }
Beispiel #3
0
        public async Task <IEnumerable <EmployeeDTO> > Create(EmployeeDTO emp)
        {
            await database.Employees.Create(CreateByMapper.CreateEmployeeByMapper(emp));

            await database.Save();

            return(null);
        }
        public async Task <IEnumerable <ProjectsEmployeesDTO> > Create(ProjectsEmployeesDTO projectsEmployeesDTO)
        {
            ProjectsEmployees      pe   = CreateByMapper.CreateProjectEmployeeByMapper(projectsEmployeesDTO);
            IEnumerable <Employee> emps = database.Employees.Find(e => e.EmployeeId == pe.EmployeeId);
            IEnumerable <Project>  ps   = database.Projects.Find(p => p.ProjectId == pe.ProjectId);

            if (emps != null && ps != null)
            {
                await database.ProjectsEmployees.Create(pe);

                await database.Save();
            }
            return(null);
        }
Beispiel #5
0
        public async Task Delete(ProjectDTO projectDTO)
        {
            Project p = CreateByMapper.CreateProjectByMapper(projectDTO);
            await database.Projects.Delete(p);

            IEnumerable <ProjectsEmployees> projectsEmployees = database.ProjectsEmployees.Find(pe => pe.ProjectId == p.ProjectId);

            if (projectsEmployees != null)
            {
                foreach (var pes in projectsEmployees)
                {
                    await database.ProjectsEmployees.Delete(pes);
                }
            }
            await database.Save();
        }
Beispiel #6
0
        public async Task Delete(EmployeeDTO emp)
        {
            Employee e = CreateByMapper.CreateEmployeeByMapper(emp);
            await database.Employees.Delete(e);

            IEnumerable <ProjectsEmployees> projectsEmployees = database.ProjectsEmployees.Find(pe => pe.EmployeeId == e.EmployeeId);

            if (projectsEmployees != null)
            {
                foreach (var pes in projectsEmployees)
                {
                    await database.ProjectsEmployees.Delete(pes);
                }
            }
            await database.Save();
        }
 public async Task <IEnumerable <ProjectsEmployeesDTO> > Find(int?projectId)
 {
     return(CreateByMapper.CreateProjectEmployeeDTOByMapper(database.ProjectsEmployees.Find(pe => pe.ProjectId == projectId)));
 }
        public async Task Delete(ProjectsEmployeesDTO projectsEmployeesDTO)
        {
            await database.ProjectsEmployees.Delete(CreateByMapper.CreateProjectEmployeeByMapper(projectsEmployeesDTO));

            await database.Save();
        }
Beispiel #9
0
        public async Task <IEnumerable <EmployeeDTO> > Find(string name)
        {
            IEnumerable <Employee> emps = database.Employees.Find(e => e.SurName.ToLower().StartsWith(name) || e.Name.ToLower().StartsWith(name) || e.Patronymic.ToLower().StartsWith(name));

            return(CreateByMapper.CreateEmployeeDTOByMapper(emps));
        }
Beispiel #10
0
        public async Task Edit(EmployeeDTO source, EmployeeDTO dest)
        {
            await database.Employees.Update(CreateByMapper.CreateEmployeeByMapper(source), CreateByMapper.CreateEmployeeByMapper(dest));

            await database.Save();
        }