private async Task <List <Separation> > GetSeparationsByIds(ICollection <Separation> separations) { var separationsIds = Separations .Select(x => x.SeparationId) .ToList(); return(await Separations .Where(x => separationsIds.Contains(x.SeparationId)) .ToListAsync()); }
public async ValueTask <bool> AddNewDoctorAsync(int separationId, Doctor doctor) { try { var sep = await Separations .Where(s => s.SeparationId == separationId) .FirstOrDefaultAsync(); if (sep == null) { return(false); } sep.DoctorList.Add(doctor); await SaveChangesAsync(); } catch { return(false); } return(true); }