public ResponseEntityVM Find(object id) { try { var policy = _repository.Find(id); if (policy == null) { return new ResponseEntityVM() { StatusCode = System.Net.HttpStatusCode.NotFound } } ; return(new ResponseEntityVM() { StatusCode = System.Net.HttpStatusCode.OK, Result = _mapper.Map <PolicyVM>(policy) }); } catch (Exception ex) { return(new ResponseEntityVM() { StatusCode = System.Net.HttpStatusCode.InternalServerError, Message = $"There was an error getting the Policies: {ex.Message}" }); } }
public async Task <FindPolicyResult> Handle(FindPolicyQuery request, CancellationToken cancellationToken) { var searchResults = await policis.Find(request.QueryText); return(FindPolicyResult(searchResults)); }
public ActionResult Edit(int id) { var obj = policyRepository.Find(id); return(View(obj)); }