public async Task <ActionResult <List <User> > > GetUsers(string tenantId) { if (await _tenantRepository.GetById(Guid.Parse(tenantId)) == null) { return(BadRequest("Tenant id is not valid")); } return(Ok(await _userRepository.GetWhere(user => user.TenantId == Guid.Parse(tenantId)))); }
public async Task <ActionResult <List <Contact> > > GetUserContacts(string tenantId, string userId) { if (_tenantRepository.GetById(Guid.Parse(tenantId)) == null) { return(BadRequest("Tenant id is not valid")); } if (_userRepository.GetById(Guid.Parse(userId)) == null) { return(BadRequest("User id is not valid")); } return(await _contactRepository.GetWhere(x => x.UserId == Guid.Parse(userId) && x.User.TenantId == Guid.Parse(tenantId))); }
public async Task <ActionResult <List <Address> > > GetUserContactAddresses(string tenantId, string userId, string contactId) { if (_tenantRepository.GetById(Guid.Parse(tenantId)) == null) { return(BadRequest("Tenant id is not valid")); } if (_userRepository.GetById(Guid.Parse(userId)) == null) { return(BadRequest("User id is not valid")); } if (_contactRepository.GetById(Guid.Parse(contactId)) == null) { return(BadRequest("contact id is not valid")); } return(await _addressRepository.GetWhere(address => address.Contact.User.Id == Guid.Parse(userId) && address.ContactID == Guid.Parse(contactId))); }