Exemplo n.º 1
0
 public void Create([FromBody] Camp Camp)
 {
     if (ModelState.IsValid)
     {
         objCamp.AddCamp(Camp);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Add camp
 /// </summary>
 /// <param name="camp"></param>
 /// <returns></returns>
 public HttpResponseMessage AddCamp([FromBody] CampDTO camp)
 {
     try
     {
         Icamp.AddCamp(camp);
         var message = Request.CreateResponse(HttpStatusCode.Created, camp);
         message.Headers.Location = new Uri(Request.RequestUri + camp.CampId.ToString());
         return(message);
     }
     catch (Exception ex) {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }