[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));
            }
        }
Example #2
0
 public IActionResult Delete(int id)
 {
     _personApplicationService.Delete(id);
     return(Ok());
 }