public bool Delete(Guid id) { PdbRestaurant res = _context.PdbRestaurants.SingleOrDefault(item => item.ID == id); _context.PdbRestaurants.DefaultIfEmpty(res); _context.Entry(res).State = System.Data.Entity.EntityState.Deleted; return(_context.SaveChanges() == 1); }
public bool Edit(PdbRestaurant res) { _context.PdbRestaurants.Attach(res); _context.Entry(res).State = System.Data.Entity.EntityState.Modified; return(_context.SaveChanges() == 1); }
public bool Create(PdbRestaurant res) { _context.PdbRestaurants.Add(res); _context.Entry(res).State = System.Data.Entity.EntityState.Added; return(_context.SaveChanges() == 1); }