public IHttpActionResult Get() { using (var organizationService = new TeleoptiOrganizationServiceClient()) { organizationService.Open(); var myTeam = organizationService.GetLoggedOnPersonTeam(DateTime.UtcNow); if (myTeam == null) { //Get first team from group page var team = organizationService.GroupPageGroupsByQuery(new GetGroupsForGroupPageAtDateQueryDto { PageId = new Guid("6CEB0041-0722-4B36-91DD-0A3B63C545CF"), QueryDate = new Sdk.DateOnlyDto { DateTime = DateTime.Today } }).FirstOrDefault(); myTeam = new Sdk.TeamDto { Id = team.Id.GetValueOrDefault() }; } if (myTeam != null) { var employees = organizationService.GetPersonsByQuery(new GetPeopleByGroupPageGroupQueryDto { GroupPageGroupId = myTeam.Id.GetValueOrDefault(), QueryDate = new Sdk.DateOnlyDto { DateTime = DateTime.Today } }); return(Ok(employees.Select(e => new { e.Name, e.Id, e.Email }).ToArray())); } } return(NotFound()); }
public IHttpActionResult Put([FromBody] EmployeeEmailInput model) { using (var organizationService = new TeleoptiOrganizationServiceClient()) { organizationService.Open(); var person = organizationService.GetPersonsByQuery(new Sdk.GetPersonByIdQueryDto { PersonId = model.Id }); if (person.Length > 0) { person[0].Email = model.NewEmail; organizationService.UpdatePerson(person[0]); } } return(Ok()); }