public async Task <ActionResult <Response> > GetOfficesByIds(string officeIds) { try { var splitString = officeIds.Split(','); var intArray = splitString.Select(digit => int.Parse(digit)).ToList(); //var intOnlyString = new string(officeIds.ToCharArray().Where(c=>char.IsDigit(c)).ToArray()); //var intArray = intOnlyString.Select(digit => int.Parse(digit.ToString())).ToList(); var response = new Response { Success = true, Data = new ResponseData { ProfileModels = await _profileDataService.GetProfilesByOfficeIdsAsync(intArray), OfficeModels = await _officeDataService.GetOfficesByIdsAsync(intArray) } }; return(Ok(response)); } catch (Exception e) { return(BadRequest(new Response { Success = false, ErrorMessage = e.Message })); } }