コード例 #1
0
        [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 Delete(int id)
 {
     _personApplicationService.Delete(id);
     return(Ok());
 }