Exemplo n.º 1
0
        public bool UpdateProduct(Product info)
        {
            using (MyContext db = new MyContext())
            {
                bool a = false;
                try
                {
                    db.Entry(info).State = EntityState.Modified;  //
                    int b = db.SaveChanges();
                    if (b == 1)
                    { a = true; }
                    return a;
                }
                catch (Exception ex)
                {

                    return a;
                }
            }
        }
Exemplo n.º 2
0
 public int Del(int id)
 {
     Context.Entry(Context.Departs.Where(s => s.DepartId == id).FirstOrDefault()).State = System.Data.Entity.EntityState.Deleted;
     return(Context.SaveChanges());
 }
Exemplo n.º 3
0
 /// <summary>
 /// 财务不需要实现删除功能
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int Del(int id)
 {
     myc.Entry(myc.Leaves.Where(s => s.LeaveId == id).FirstOrDefault()).State = EntityState.Deleted;
     return(myc.SaveChanges());
 }
Exemplo n.º 4
0
 public void Remove(T entity)
 {
     context.Entry(entity).State = EntityState.Deleted;
     context.SaveChanges();
 }
Exemplo n.º 5
0
 /// <summary>
 /// 财务部不需要实现修改功能
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 public int Upt(Salary t)
 {
     myc.Entry(t).State = System.Data.Entity.EntityState.Modified;
     return(myc.SaveChanges());
 }