예제 #1
0
 public List <Table> GetAllTables()
 {
     using (var db = new projectContext(conn.ConnectionString))
     {
         return(db.Tables.ToList());
     }
 }
예제 #2
0
 public Person GetPersonByEmail(string email)
 {
     using (var db = new projectContext(conn.ConnectionString))
     {
         return(db.Persons.FirstOrDefault(x => x.Email.Equals(email)));
     }
 }
예제 #3
0
 public List <Ration> GetAllRations()
 {
     using (var db = new projectContext(conn.ConnectionString))
     {
         return(db.Rations.ToList());
     }
 }
예제 #4
0
 public List <Ration> GetAllRationsOfSpasificTable(int idTable)
 {
     using (var db = new projectContext(conn.ConnectionString))
     {
         return(db.Rations.Where(x => x.TableId == idTable).ToList());
     }
 }
예제 #5
0
        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();
                }
            }
        }
예제 #6
0
        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();
                    }
                }
            }
        }
예제 #7
0
        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();
                    }
                }
            }
        }
예제 #8
0
 public PointsTablesController(projectContext context)
 {
     _context = context;
 }
예제 #9
0
 public ReturnsService(projectContext context) : base(context)
 {
     _context = context;
 }
예제 #10
0
 public RoyalChallengersBangloresController(projectContext context)
 {
     _context = context;
 }
예제 #11
0
 public SunRisesHyderabadsController(projectContext context)
 {
     _context = context;
 }
예제 #12
0
 public TopBatsmenController(projectContext context)
 {
     _context = context;
 }
예제 #13
0
 public TopFieldersController(projectContext context)
 {
     _context = context;
 }
예제 #14
0
 public StoresService(projectContext context) : base(context)
 {
     _context = context;
 }
예제 #15
0
 public DelhiCapitalsController(projectContext context)
 {
     _context = context;
 }
예제 #16
0
 public TopBowlersController(projectContext context)
 {
     _context = context;
 }
예제 #17
0
 public OrderProductStoresService(projectContext context) : base(context)
 {
     _context = context;
 }
예제 #18
0
 public CategoriesService(projectContext context) : base(context)
 {
     _context = context;
 }
예제 #19
0
 public KingsXipunjabsController(projectContext context)
 {
     _context = context;
 }
예제 #20
0
 public MumbaiIndiansController(projectContext context)
 {
     _context = context;
 }
예제 #21
0
 public MatchesController(projectContext context)
 {
     _context = context;
 }
예제 #22
0
 public ChennaiSuperKingsController(projectContext context)
 {
     _context = context;
 }
예제 #23
0
 public CustomersService(projectContext context) : base(context)
 {
     _context = context;
 }
예제 #24
0
 public ProductsService(projectContext context) : base(context)
 {
     _context = context;
 }
예제 #25
0
 public AddressesService(projectContext context) : base(context)
 {
     _context = context;
 }
예제 #26
0
 public CarRentRepository(projectContext context)
 {
     _context = context;
 }
예제 #27
0
 public ResponsesService(projectContext context) : base(context)
 {
     _context = context;
 }
 public RajasthanRoyalsController(projectContext context)
 {
     _context = context;
 }
예제 #29
0
 public KolkataKnightRidersController(projectContext context)
 {
     _context = context;
 }
예제 #30
0
 public OrdersService(projectContext context) : base(context)
 {
     _context = context;
 }