public HttpResponseMessage Search(SearchContactDto searchContactDto) { try { var searchResult = _contactApplicationService.Search(searchContactDto); return(Request.CreateResponse(HttpStatusCode.OK, searchResult)); } catch (ValidationException ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)); } }
public ActionResult Index(SearchContactViewModel searchContactViewModel) { try { searchContactViewModel.PagedResult = _contactApplicationService.Search(searchContactViewModel.PagedFilter); } catch (ValidationException ex) { ModelState.AddValidationErrors(ex); } return(View(searchContactViewModel)); }