public async Task <ActionResult> Get(int instanceOwnerId, string applicationOwnerId) { if (instanceOwnerId != 0) { var result = await _instanceRepository.GetInstancesOfInstanceOwnerAsync(instanceOwnerId); if (result == null) { return(NotFound()); } return(Ok(result)); } else if (!string.IsNullOrEmpty(applicationOwnerId)) { var result = await _instanceRepository.GetInstancesOfApplicationOwnerAsync(applicationOwnerId); if (result == null) { return(NotFound()); } return(Ok(result)); } return(BadRequest()); }
public async Task <ActionResult> GetMany(int instanceOwnerId, string applicationOwnerId, string applicationId) { if (instanceOwnerId != 0) { var result = await _instanceRepository.GetInstancesOfInstanceOwnerAsync(instanceOwnerId); if (result == null || result.Count == 0) { return(NotFound("Did not find any instances for instanceOwnerId=" + instanceOwnerId)); } return(Ok(result)); } else if (!string.IsNullOrEmpty(applicationOwnerId)) { var result = await _instanceRepository.GetInstancesOfApplicationOwnerAsync(applicationOwnerId); if (result == null || result.Count == 0) { return(NotFound("Did not find any instances for applicationOwnerId=" + applicationOwnerId)); } return(Ok(result)); } else if (!string.IsNullOrEmpty(applicationId)) { var result = await _instanceRepository.GetInstancesOfApplicationAsync(applicationId); if (result == null || result.Count == 0) { return(NotFound("Did not find any instances for applicationId=" + applicationId)); } return(Ok(result)); } return(BadRequest("Unable to perform query")); }