public void ShareServiceDescriptionWithUser(int idServiceDescription, int idUserToShare) { var notYetShared = _serviceDescription_UserRepository.GetAllBySharedUser(idUserToShare).Count(x => x.IdServiceDescription == idServiceDescription) == 0; if (notYetShared) { var serviceDescription_User = new ServiceDescription_User { IdServiceDescription = idServiceDescription, IdSharedUser = idUserToShare }; _serviceDescription_UserRepository.Create(serviceDescription_User); _serviceDescription_UserRepository.SaveChanges(); } }
public List <ServiceDescription_User> GetAllBySharedUser(int idUser) { return(_serviceDescription_UserRepository.GetAllBySharedUser(idUser).ToList()); }