Example #1
0
        public int DeleteUserById(int Id)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            InfoUser       usrdtl = new InfoUser();

            usrdtl.ID = Id;
            tstDb.Entry(usrdtl).State = EntityState.Deleted;
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Example #2
0
        public int AddUser(string Name, string Email)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            InfoUser       usrdtl = new InfoUser();

            usrdtl.Name  = Name;
            usrdtl.Email = Email;
            tstDb.InfoUsers.Add(usrdtl);
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Example #3
0
        public int UpdateUser(int Id, string Name, string Email)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            InfoUser       usrdtl = new InfoUser();

            usrdtl.ID    = Id;
            usrdtl.Name  = Name;
            usrdtl.Email = Email;
            tstDb.Entry(usrdtl).State = EntityState.Modified;

            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Example #4
0
        public InfoUser GetAllUserById(int id)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            var            lstUsr = from k in tstDb.InfoUsers where k.ID == id select k;
            InfoUser       usr    = new InfoUser();

            foreach (var item in lstUsr)
            {
                usr.ID    = item.ID;
                usr.Name  = item.Name;
                usr.Email = item.Email;
            }

            return(usr);
        }
Example #5
0
        public List <InfoUser> GetAllUser()
        {
            List <InfoUser> userlst = new List <InfoUser>();
            TestDBEntities  tstDb   = new TestDBEntities();
            var             lstUsr  = from k in tstDb.InfoUsers select k;

            foreach (var item in lstUsr)
            {
                InfoUser usr = new InfoUser();
                usr.ID    = item.ID;
                usr.Name  = item.Name;
                usr.Email = item.Email;
                userlst.Add(usr);
            }

            return(userlst);
        }