示例#1
0
        // PUT: api/Beds/5
        public IHttpActionResult Put([FromBody] BedView bed)
        {
            var model  = _mapper.MapBedViewToBed(bed);
            var result = _service.UpdateBed(model);

            if (result)
            {
                return(Ok(result));
            }
            else
            {
                return(InternalServerError());
            }
        }
示例#2
0
 /// <summary>
 /// Change a single value in the list
 /// </summary>
 /// <param name=<em>"id"</em>>The id of the value to be changed</param>
 /// <param name=<em>"value"</em>>The new value</param>
 // PUT: api/Bed/5
 public HttpResponseMessage Put(int id, [FromBody] Bed obj)
 {
     try
     {
         Bed res = null;
         if (id >= 0)
         {
             res = _BedService.UpdateBed(id, obj);
         }
         if (res != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, res));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, "Data Not Updated"));
         }
     }
     catch (Exception ex)
     {
         throw ex;
         //return new HttpResponseMessage(HttpStatusCode.InternalServerError);
     }
 }