示例#1
0
        public int Edit(Doquantrong dqt)
        {
            Doquantrong dqts = tb.Doquantrong.Find(dqt.Iddqt);

            dqts.Tendqt = dqt.Tendqt;
            try
            {
                tb.Entry(dqts).State = EntityState.Modified;
                tb.SaveChanges();
                return(1);
            }
            catch
            {
                throw;
            }
        }
示例#2
0
        public int Create([FromBody] Doquantrong dqt)
        {
            dqt.Iddqt = Auto_id();

            tb.Doquantrong.Add(dqt);
            try
            {
                if (ModelState.IsValid)
                {
                    tb.SaveChanges();
                }
                return(1);
            }
            catch (DbUpdateException)
            {
                throw;
            }
        }
示例#3
0
        public int Delete(string id)
        {
            try
            {
                Doquantrong dqt = tb.Doquantrong.Find(id);

                if (dqt != null)
                {
                    tb.Doquantrong.Remove(dqt);
                    tb.SaveChanges();
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch
            {
                throw;
            }
        }