public Boolean InsertInventoryPart(InventoryPart inventPart)
 {
     try
     {
         MongoCollection<InventoryPart> part_coll = objDatabse.GetCollection<InventoryPart>("invent");
         part_coll.Insert<InventoryPart>(inventPart);
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
        public HttpResponseMessage Post(InventoryPart part)
        {
            if (!this.ModelState.IsValid)
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest));

            Boolean result = inventory_part.InsertInventoryPart(part);

            HttpContext context = HttpContext.Current;

            var response = Request.CreateResponse(HttpStatusCode.Created, result);
            response.Headers.Add("Access-Control-Allow-Origin", "*");

            return response;
        }
Exemplo n.º 3
0
 public InventoryPart(InventoryPart part)
 {
     this.InvPartInStock = new List<InventoryPartInStock>();
 }