Пример #1
0
        public Billerdata getSingle(int i)
        {
            Biller a = e.Billers.Find(i);

            if (a != null)
            {
                Billerdata d = new Billerdata();
                d.Id        = a.Id;
                d.Branch_ID = a.Branch_ID;
                d.Contact   = a.Contact;
                d.DOB       = a.DOB;
                d.Email     = a.Email;
                d.Password  = a.Password;
                d.Location  = a.Branch.Location;
                return(d);
            }
            return(null);
        }
Пример #2
0
        public List <Billerdata> selectBillerperBranch(int id)
        {
            var a = e.Billers.Where(m => m.Branch_ID == id).ToList();
            List <Billerdata> l = new List <Billerdata>();

            foreach (Biller i in a)
            {
                Billerdata d = new Billerdata();

                d.Id        = i.Id;
                d.Branch_ID = i.Branch_ID;
                d.Contact   = i.Contact;
                d.DOB       = i.DOB;
                d.Email     = i.Email;
                d.Password  = i.Password;
                d.Location  = i.Branch.Location;
                l.Add(d);
            }
            return(l);
        }
Пример #3
0
        public Billerdata deleteBiller(int id)
        {
            Biller a = e.Billers.Find(id);

            if (a != null)
            {
                e.Billers.Remove(a);
                e.SaveChanges();
                Billerdata d = new Billerdata();
                d.Id        = a.Id;
                d.Branch_ID = a.Branch_ID;
                d.Contact   = a.Contact;
                d.DOB       = a.DOB;
                d.Email     = a.Email;
                d.Password  = a.Password;
                d.Location  = "";
                return(d);
            }
            return(null);
        }
Пример #4
0
        public Billerdata updateBiller(Biller a)
        {
            Biller old = e.Billers.Where(
                x => x.Id == a.Id).SingleOrDefault();

            if (old != null)
            {
                e.Entry(old).CurrentValues.SetValues(a);
                e.SaveChanges();
                Billerdata d = new Billerdata();
                d.Id        = a.Id;
                d.Branch_ID = a.Branch_ID;
                d.Contact   = a.Contact;
                d.DOB       = a.DOB;
                d.Email     = a.Email;
                d.Password  = a.Password;
                d.Location  = "";
                return(d);
            }
            return(null);
        }