Exemplo n.º 1
0
        public IEnumerable <TeamDetailDto> GetAllTeams()
        {
            List <TeamDetailDto> TeamList = new List <TeamDetailDto>();


            try
            {
                var allTeam = Context.TeamDetails.ToList();

                foreach (TeamDetails teamDetail in allTeam)
                {
                    TeamDetailDto team = new TeamDetailDto();
                    team.TeamId         = teamDetail.TeamID;
                    team.TeamName       = teamDetail.TeamName;
                    team.TeamDicription = teamDetail.TeamDiscription;
                    team.LeadName       = teamDetail.TeamLeadName;

                    TeamList.Add(team);
                }
            }
            catch (SqlException expSql)
            {
                throw expSql;
            }
            catch (NullReferenceException expNull)
            {
                throw expNull;
            }
            return(TeamList);
        }
Exemplo n.º 2
0
 public IActionResult AddNewTeam([FromBody] TeamDetailDto newTeam,
                                 [FromHeader(Name = "id_token")] string googleToken)
 {
     try
     {
         if (googleAuth.ProcessRequestAtGoogle(googleToken))
         {
             var TeamAddStatus = empRepository.AddTeam(newTeam);
             return(Ok(Json(TeamAddStatus)));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception exp)
     {
         return(NotFound(@"Can't add the given Team"));
     }
 }
Exemplo n.º 3
0
        /*
         * This method to add new team to the Db with given Details
         */
        public int AddTeam(TeamDetailDto toAddTeam)
        {
            TeamDetails teamData = new TeamDetails();

            try
            {
                teamData.TeamDiscription = toAddTeam.TeamDicription;
                teamData.TeamLeadName    = toAddTeam.LeadName;
                teamData.TeamName        = toAddTeam.TeamName;
                Context.TeamDetails.Add(teamData);
                Context.SaveChanges();
            }
            catch (SqlException sqlExp)
            {
                throw sqlExp;
            }
            catch (NullReferenceException expNull)
            {
                throw expNull;
            }
            return(teamData.TeamID);
        }
Exemplo n.º 4
0
        /*
         * This method returns only the Employee Details of given employeeID
         */
        public EmployeeDto EmployeeDetails(int emplId)
        {
            try
            {
                var Employee = Context.Employees
                               .Include(emp => emp.ContactDetails)
                               .Include(emp => emp.DepartmentDetails)
                               .Include(emp => emp.EmployeeBiography)
                               .Include(emp => emp.employeeRoles)
                               .Include(emp => emp.TeamDetails)
                               .Include(emp => emp.EmployeeBiography)
                               .FirstOrDefault(emp => emp.EmployeeId == emplId);
                var skills = Context.EmployeeSkills
                             .Include(s => s.skills)
                             .Where(s => s.EmployeeId == Employee.EmployeeId)
                             .Select(s => new EmployeeSkillsDto
                {
                    SkillName  = s.skills.SkillName,
                    SkillLevel = s.SkillLevel,
                    EmployeeId = s.EmployeeId,
                    SkillId    = s.SkillId
                }).ToList();

                EmployeeDto          empl    = new EmployeeDto();
                RolesDto             role    = new RolesDto();
                DepartmentDetailsDto depart  = new DepartmentDetailsDto();
                TeamDetailDto        team    = new TeamDetailDto();
                ContactDto           contact = new ContactDto();
                BioGraphyDto         bio     = new BioGraphyDto();

                empl.FirstName   = Employee.FirstName;
                empl.LastName    = Employee.LastName;
                empl.EmployeeId  = Employee.EmployeeId;
                empl.Dob         = Employee.Dob;
                empl.JoiningDate = Employee.JoiningDate;
                empl.EmailId     = Employee.EmailID;
                empl.PhotoUrl    = Employee.EmployeePhotoURL;
                empl.SPOC        = Employee.SPOC;
                role.RoleName    = Employee.employeeRoles.RoleName;
                empl.Role        = role;

                depart.DepartmentName = Employee.DepartmentDetails.DepartmentName;
                empl.Departmnent      = depart;


                team.TeamName = Employee.TeamDetails.TeamName;
                team.LeadName = Employee.TeamDetails.TeamLeadName;
                empl.Team     = team;

                contact.Address        = Employee.ContactDetails.Address;
                contact.MobileOffice   = Employee.ContactDetails.MobNumberOff;
                contact.MobilePersonal = Employee.ContactDetails.MobNumberPersonal;
                contact.SkypeId        = Employee.ContactDetails.SkypeID;
                contact.SlackId        = Employee.ContactDetails.SlackID;
                contact.FBLink         = Employee.ContactDetails.FBLink;
                contact.TwitterLink    = Employee.ContactDetails.TwitterLink;
                contact.GitHubLink     = Employee.ContactDetails.GitHubLink;
                contact.LinkdinLink    = Employee.ContactDetails.linkdinLink;
                empl.ContactDetail     = contact;

                bio.About     = Employee.EmployeeBiography.About;
                bio.Hobbies   = Employee.EmployeeBiography.Hobbies;
                bio.Interests = Employee.EmployeeBiography.Interests;
                empl.Bio      = bio;

                foreach (EmployeeSkillsDto empSkill in skills)
                {
                    empl.EmployeeSkills.Add(empSkill);
                }

                return(empl);
            }
            catch (SqlException exSql)
            {
                throw exSql;
            }
            catch (NullReferenceException expNull)
            {
                throw expNull;
            }
        }