public async Task <StaffMember> AddDemandStaffMember(DemandIdCouple couple) { StaffMember result = null; var demand = await _context.Demands.Include(t => t.Staff) .FirstOrDefaultAsync(x => x.Id == couple.IdDemand); if (demand != null) { var staff = await _context.Staff.FirstOrDefaultAsync(x => x.Id == couple.IdStaffMember); if (staff != null) { demand.Staff.Add(staff); result = staff; } } await _context.SaveChangesAsync(); return(result); }
public async Task <StaffMember> AddDemandStaffMember([FromBody] DemandIdCouple couple) { return(await repository.AddDemandStaffMember(couple)); }