public IHttpActionResult PutVendorCreation(decimal id, VendorCreation vendorCreation)
        {
            if (id != vendorCreation.vd_id)
            {
                return(BadRequest());
            }

            db.Entry(vendorCreation).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VendorCreationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetVendorCreation(decimal id)
        {
            VendorCreation vendorCreation = db.VendorCreations.Find(id);

            if (vendorCreation == null)
            {
                return(NotFound());
            }

            return(Ok(vendorCreation));
        }
        public IHttpActionResult DeleteVendorCreation(int id)
        {
            VendorCreation vendorCreation = db.VendorCreations.Find(id);

            if (vendorCreation == null)
            {
                return(NotFound());
            }

            db.VendorCreations.Remove(vendorCreation);
            db.SaveChanges();

            return(Ok(vendorCreation));
        }
        public int PostVendorCreation(VendorCreation vendorCreation)
        {
            /*db.VendorCreations.Add(vendorCreation);
             * db.SaveChanges();
             *
             * return CreatedAtRoute("DefaultApi", new { id = vendorCreation.vd_id }, vendorCreation);*/
            VendorCreation vendor = new VendorCreation();

            vendor = db.VendorCreations.Where(x => x.vd_name == vendorCreation.vd_name && x.vd_atype_id == vendorCreation.vd_atype_id).FirstOrDefault();
            if (vendor == null)
            {
                db.VendorCreations.Add(vendorCreation);
                db.SaveChanges();
                return(0);
            }
            else
            {
                return(1);
            }
        }