public IHttpActionResult Putvendor_creation(decimal id, vendor_creation vendor_creation)
        {
            if (id != vendor_creation.vd_id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult Getvendor_creation(decimal id)
        {
            vendor_creation vendor_creation = db.vendor_creation.Find(id);

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

            return(Ok(vendor_creation));
        }
        public IHttpActionResult Deletevendor_creation(decimal id)
        {
            vendor_creation vendor_creation = db.vendor_creation.Find(id);

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

            db.vendor_creation.Remove(vendor_creation);
            db.SaveChanges();

            return(Ok(vendor_creation));
        }
        public int Postvendor(vendor_creation vendor)
        {
            vendor_creation vd = new vendor_creation();

            vd = db.vendor_creation.Where(x => x.vd_name == vendor.vd_name && x.vd_atype_id == vendor.vd_atype_id).FirstOrDefault();
            if (vd == null)
            {
                db.vendor_creation.Add(vendor);
                db.SaveChanges();
                return(1);
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 5
0
        public int Postvendor_creation(vendor_creation vendor_creation)
        {
            vendor_creation vendor = new vendor_creation();

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