public HttpResponseMessage updateArticleComponent(String id, Models.MstArticleComponent component)
        {
            try
            {
                var components = from d in db.MstArticleComponents where d.Id == Convert.ToInt32(id) select d;
                if (components.Any())
                {
                    var updateComponent = components.FirstOrDefault();
                    updateComponent.ArticleId          = component.ArticleId;
                    updateComponent.ComponentArticleId = component.ComponentArticleId;
                    updateComponent.Quantity           = component.Quantity;
                    updateComponent.Particulars        = component.Particulars;

                    db.SubmitChanges();

                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }
            }
            catch
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
        public Int32 insertArticleComponent(Models.MstArticleComponent component)
        {
            try
            {
                Data.MstArticleComponent newComponent = new Data.MstArticleComponent();
                newComponent.ArticleId          = component.ArticleId;
                newComponent.ComponentArticleId = component.ComponentArticleId;
                newComponent.Quantity           = component.Quantity;
                newComponent.Particulars        = component.Particulars;

                db.MstArticleComponents.InsertOnSubmit(newComponent);
                db.SubmitChanges();

                return(newComponent.Id);
            }
            catch
            {
                return(0);
            }
        }