示例#1
0
        // DELETE: api/Person/5
        public HttpResponseMessage Delete(int id)
        {
            PersonPersistence pp = new PersonPersistence();
            bool isInRecord      = false;
            HttpResponseMessage response;

            isInRecord = pp.DeletePerson(id);
            if (isInRecord)
            {
                return(response = Request.CreateResponse(HttpStatusCode.NoContent));
            }
            else
            {
                return(response = Request.CreateResponse(HttpStatusCode.NotFound));
            }
        }
示例#2
0
        /// <summary>
        /// Update a person by ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        // DELETE: api/Person/5
        public HttpResponseMessage Delete(long id)
        {
            PersonPersistence pp = new PersonPersistence();
            bool recordExisted   = false;

            recordExisted = pp.DeletePerson(id);
            HttpResponseMessage response;

            if (recordExisted)
            {
                response = Request.CreateResponse(HttpStatusCode.NoContent);
            }
            else
            {
                response = Request.CreateResponse(HttpStatusCode.NotFound);
            }
            return(response);
        }