[Route("delete/{id}")] //url: /api/person/delete/id
        public HttpResponseMessage Delete(Guid id)
        {
            try
            {
                Person p = appPerson.FindById(id);

                if (p != null)
                {
                    appPerson.Delete(p);

                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    throw new Exception("Person not found.");
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
示例#2
0
        public IActionResult Get(string personId)
        {
            var person = _personApplicationService.FindById(personId);

            return(Ok(PersonAssembler.ToDTO(person)));
        }