コード例 #1
0
 public HttpResponseMessage DeletePerson([FromBody] Praksa.Model.Person person)
 {
     if (person != null)
     {
         peopleService.DeletePerson(person);
         return(Request.CreateResponse(HttpStatusCode.OK, "Delete done "));
     }
     return(Request.CreateResponse(HttpStatusCode.NotFound, "Not valid data"));
 }
コード例 #2
0
        public async Task <HttpResponseMessage> DeletePersonAsync([FromBody] Praksa.Model.Person person)
        {
            if (person != null)
            {
                await Service.DeletePersonAsync(person);

                return(Request.CreateResponse(HttpStatusCode.OK, "Delete done "));
            }
            return(Request.CreateResponse(HttpStatusCode.NotFound, "Not valid data"));
        }
コード例 #3
0
        public async Task <HttpResponseMessage> AddPersonAsync([FromBody] Praksa.Model.Person person)
        {
            //check valid data
            if (person != null)
            {
                await peopleService.AddPersonAsync(person);

                return(Request.CreateResponse(HttpStatusCode.OK, "Add done"));
            }
            return(Request.CreateResponse(HttpStatusCode.NotFound, "Not valid data"));
        }
コード例 #4
0
 public HttpResponseMessage UpdatePerson([FromBody] Praksa.Model.Person person)
 {
     //check for valid data
     //here we can check for more like if clinet put correct name,lastname..etc..
     if (person != null)
     {
         //data is valid
         peopleService.UpdatePerson(person);
         return(Request.CreateResponse(HttpStatusCode.OK, "Update done"));
     }
     //data is empty
     return(Request.CreateResponse(HttpStatusCode.NotFound, "Not valid data"));
 }