// POST api/CompanyBranchType
        public HttpResponseMessage PostCompanyBranchType(CompanyBranchType companybranchtype)
        {
            if (ModelState.IsValid)
            {
                companybranchtype.InsertBy = loginUser.UserID;
                db.CompanyBranchTypes.Add(companybranchtype);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, companybranchtype);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = companybranchtype.CompanyBranchTypeID }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
        // PUT api/CompanyBranchType/5
        public HttpResponseMessage PutCompanyBranchType(long id, CompanyBranchType companybranchtype)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != companybranchtype.CompanyBranchTypeID)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            companybranchtype.UpdateBy = loginUser.UserID;
            db.Entry(companybranchtype).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }