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}"
                });
            }
        }
예제 #2
0
        public async Task <FindPolicyResult> Handle(FindPolicyQuery request, CancellationToken cancellationToken)
        {
            var searchResults = await policis.Find(request.QueryText);

            return(FindPolicyResult(searchResults));
        }
예제 #3
0
        public ActionResult Edit(int id)
        {
            var obj = policyRepository.Find(id);

            return(View(obj));
        }