/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="firstname"></param> /// <param name="lastname"></param> /// <returns></returns> public ApiResponse <List <PersonWithIdentfiersResult> > GetPersonByFirstNameOrLastName(TestProjectDbContext context, string firstname, string lastname) { try { var result = _repository.GetPersonByFirstNameOrLastName(context, firstname, lastname).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)); } }