public int Post(tProduct p) //新增
        {
            int n = 0;

            try
            {
                dbmyDBEntities db = new dbmyDBEntities();

                if (string.IsNullOrEmpty(p.fName))
                {
                    return(n);
                }
                db.tProduct.Add(p);
                n = db.SaveChanges();
            }
            catch (Exception ex)
            {
                n = 0;
            }

            return(n);
        }
Beispiel #2
0
        // POST: api/ApiOrder
        public int Post(tOrder o)
        {
            int n = 0;

            try
            {
                dbmyDBEntities db = new dbmyDBEntities();

                if (string.IsNullOrEmpty(o.fAddress))
                {
                    return(n);
                }
                db.tOrder.Add(o);
                n = db.SaveChanges();
            }
            catch (Exception ex)
            {
                n = 0;
            }

            return(n);
        }