public int AddProvider(tblProvider provider) { if (provider != null) { using (var db = new ProviderDAL()) { db.tblProviders.Add(provider); db.SaveChanges(); return(provider.providerID); } } return(0); }
public int BlockById(int id) { using (var db = new ProviderDAL()) { var result = db.tblProviders.SingleOrDefault(p => p.providerID == id); if (result != null) { result.blocked = true; db.SaveChanges(); return(result.providerID); } return(0); } }
public int DeleteProviderById(int id) { using (var db = new ProviderDAL()) { tblProvider provider = GetProviderById(id); if (provider != null) { db.Entry(provider).State = EntityState.Deleted; db.SaveChanges(); return(1); } return(0); } }