/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="type"></param> /// <returns></returns> public ApiResponse <List <PersonWithIdentfiersResult> > GetPersonBySpecificIdentifiers(TestProjectDbContext context, IdentifiersType type) { try { var result = _repository.GetPersonBySpecificIdentifiers(context, type).Select(x => new PersonWithIdentfiersResult { Id = x.Id, FirstName = x.FirstName, LastName = x.LastName, Identifiers = x.Identifiers.Select(a => new IdentifierResult { Id = a.Id, Type = a.Type, Value = a.Value }) }).ToList(); return(ApiResponse <List <PersonWithIdentfiersResult> > .SuccessResult(result)); } catch (Exception ex) when(ex is FailException || ex is ValidationException || ex is ArgumentException) { return(ApiResponse <List <PersonWithIdentfiersResult> > .ErrorResult(message : ex.Message, statusCode : HttpStatusCode.BadRequest)); } catch (Exception ex) when(ex is ErrorException) { //LoggingManager.Error(ex.ToString()); return(ApiResponse <List <PersonWithIdentfiersResult> > .ErrorResult(message : ex.Message)); } catch (Exception ex) { //LoggingManager.Error(ex.ToString()); return(ApiResponse <List <PersonWithIdentfiersResult> > .ErrorResult(message : ex.Message)); } }