Example #1
0
 // GET api/pocxml/5
 public IHttpActionResult Get(int id)
 {
     if (POCXmlDB.Count(id) == 0)
     {
         return(NotFound());
     }
     else
     {
         return(Json(POCXmlDB.Get(id)));
     }
 }
Example #2
0
        // PUT api/pocxml/5
        public IHttpActionResult Put([FromUri] Int32 id, [FromBody] ConXmlModel model)
        {
            if (POCXmlDB.Count(id) == 0)
            {
                return(BadRequest(
                           string.Format("Conversion Xml entry for id {0} doest not exist", id)));
            }

            if (ModelState.IsValid)
            {
                POCXml xml = new POCXml()
                {
                    Xml_Id     = id,
                    Xml_TypeId = model.Xml_TypeId,
                    XmlFile    = model.XmlFile
                };
                POCXmlDB.Update(xml);
                return(Ok());
            }
            else
            {
                return(BadRequest("Data is invalid"));
            }
        }