public List <Table> GetAllTables() { using (var db = new projectContext(conn.ConnectionString)) { return(db.Tables.ToList()); } }
public Person GetPersonByEmail(string email) { using (var db = new projectContext(conn.ConnectionString)) { return(db.Persons.FirstOrDefault(x => x.Email.Equals(email))); } }
public List <Ration> GetAllRations() { using (var db = new projectContext(conn.ConnectionString)) { return(db.Rations.ToList()); } }
public List <Ration> GetAllRationsOfSpasificTable(int idTable) { using (var db = new projectContext(conn.ConnectionString)) { return(db.Rations.Where(x => x.TableId == idTable).ToList()); } }
public void Delete(object obj) { using (var db = new projectContext(conn.ConnectionString)) { if (obj is Person) { Person p = (Person)obj; var person = db.Persons.FirstOrDefault(x => x.FirstName == p.FirstName); db.Persons.Remove(person); db.SaveChanges(); } if (obj is Ration) { Ration r = (Ration)obj; var ration = db.Rations.FirstOrDefault(x => x.RationId == r.RationId); db.Rations.Remove(ration); db.SaveChanges(); } if (obj is Table) { Table t = (Table)obj; var table = db.Tables.FirstOrDefault(x => x.TableId == t.TableId); db.Tables.Remove(table); db.SaveChanges(); } } }
public void Update(object obj) { using (var db = new projectContext(conn.ConnectionString)) { if (obj is Person) { Person p = (Person)obj; var person = db.Persons.FirstOrDefault(x => x.PersonId == p.PersonId); if (person != null) { person.PersonId = p.PersonId; person.FirstName = p.FirstName; person.LastName = p.LastName; person.Email = p.Email; person.Password = p.Password; person.PersonType = p.PersonType; db.SaveChanges(); } } if (obj is Ration) { Ration r = (Ration)obj; var ration = db.Rations.FirstOrDefault(x => x.RationId == r.RationId); if (ration != null) { ration.RationId = r.RationId; ration.Price = r.Price; ration.Type = r.Type; ration.Done = r.Done; ration.TableId = r.TableId; //if(r.Table != null) // Update(r.Table); db.SaveChanges(); } } if (obj is Table) { Table t = (Table)obj; var table = db.Tables.FirstOrDefault(x => x.TableId == t.TableId); if (table != null) { table.TableId = t.TableId; table.Plasace = t.Plasace; table.Notes = t.Notes; foreach (var ration in t.RationList) { Update(ration); } db.SaveChanges(); } } } }
public void Insert(object obj) { using (var db = new projectContext(conn.ConnectionString)) { if (obj is Person) { try { Open(); Person p = (Person)obj; db.Persons.Add(p); db.SaveChanges(); } finally { Close(); } } if (obj is Ration) { try { Open(); Ration r = (Ration)obj; db.Rations.Add(r); db.SaveChanges(); } finally { Close(); } } if (obj is Table) { try { Open(); Table t = (Table)obj; db.Tables.Add(t); db.SaveChanges(); } finally { Close(); } } } }
public PointsTablesController(projectContext context) { _context = context; }
public ReturnsService(projectContext context) : base(context) { _context = context; }
public RoyalChallengersBangloresController(projectContext context) { _context = context; }
public SunRisesHyderabadsController(projectContext context) { _context = context; }
public TopBatsmenController(projectContext context) { _context = context; }
public TopFieldersController(projectContext context) { _context = context; }
public StoresService(projectContext context) : base(context) { _context = context; }
public DelhiCapitalsController(projectContext context) { _context = context; }
public TopBowlersController(projectContext context) { _context = context; }
public OrderProductStoresService(projectContext context) : base(context) { _context = context; }
public CategoriesService(projectContext context) : base(context) { _context = context; }
public KingsXipunjabsController(projectContext context) { _context = context; }
public MumbaiIndiansController(projectContext context) { _context = context; }
public MatchesController(projectContext context) { _context = context; }
public ChennaiSuperKingsController(projectContext context) { _context = context; }
public CustomersService(projectContext context) : base(context) { _context = context; }
public ProductsService(projectContext context) : base(context) { _context = context; }
public AddressesService(projectContext context) : base(context) { _context = context; }
public CarRentRepository(projectContext context) { _context = context; }
public ResponsesService(projectContext context) : base(context) { _context = context; }
public RajasthanRoyalsController(projectContext context) { _context = context; }
public KolkataKnightRidersController(projectContext context) { _context = context; }
public OrdersService(projectContext context) : base(context) { _context = context; }