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
示例#2
0
        protected override StaffMember createStaff(ProjectOrganisation org, string name)
        {
            var csm = TestHelper.newStaff(name);

            return(repo_.AddStaffMember(org.Id, csm).Where(s => s.Name == csm.Name).Single());
        }