public void Update(Company item) { using (var context = new WebDal()) { context.Entry(item).State = EntityState.Modified; context.SaveChanges(); } }
public int Add(Company item) { using (var context = new WebDal()) { context.Companies.Add(item); context.SaveChanges(); return(item.Id); } }
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(); } }