示例#1
0
        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);
        }
示例#2
0
 public async Task <StaffMember> AddDemandStaffMember([FromBody] DemandIdCouple couple)
 {
     return(await repository.AddDemandStaffMember(couple));
 }