示例#1
0
 public void Update(Company item)
 {
     using (var context = new WebDal())
     {
         context.Entry(item).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#2
0
        public int Add(Company item)
        {
            using (var context = new WebDal())
            {
                context.Companies.Add(item);
                context.SaveChanges();

                return(item.Id);
            }
        }
示例#3
0
 public void Delete(int id)
 {
     using (var context = new WebDal())
     {
         var db = context.Companies.FirstOrDefault(a => a.Id == id);
         if (db != null)
         {
             db.IsDeleted = true;
         }
         context.SaveChanges();
     }
 }