public IHttpActionResult AddStaffMemberToOrganisation(Guid id, Guid? projId, CreateStaffMember csm) { if (!ModelState.IsValid) return badModelState(); try { var staff = repo_.AddStaffMember(id, csm); if (projId.HasValue) staff = staff.Where(sm => sm.ProjectIds.Contains(projId.Value)).ToList(); return Ok(staff); } catch (Exception e) { return BadRequest(e.Message); } } // AddStaffMemberToOrganisation
} // AddProjectCommissioner ////////////////////// public IList<StaffMember> AddStaffMember(Guid orgId, CreateStaffMember newStaff) { using (var authRepo = new AuthRepository()) { var result = authRepo.RegisterUser(newStaff.UserName, newStaff.Password, newStaff.Roles); if (!result.Succeeded) throw new Exception(String.Join("\n", result.Errors)); } // using newStaff.Id = Guid.NewGuid(); var pod = POD(orgId); if (pod.Staff == null) pod.Staff = new List<StaffMemberData>(); pod.Staff.Add(newStaff.staffData()); Commit(pod); return FetchStaffMembers(orgId); } // AddStaffMember
public IHttpActionResult AddStaffMemberToOrganisation(Guid id, CreateStaffMember csm) { return AddStaffMemberToOrganisation(id, null, csm); } // AddStaffMemberToOrganisation