Esempio n. 1
0
        public List <ClientInfo> GetAllClients()
        {
            List <ClientInfo> clientList = new List <ClientInfo>();
            ClientEntities    clnDb      = new ClientEntities();
            var lstClient = from k in clnDb.ClientInfoes select k;

            foreach (var item in lstClient)
            {
                ClientInfo cln = new ClientInfo();

                cln.pkclientId    = item.pkclientId;
                cln.FirstName     = item.FirstName;
                cln.LastName      = item.LastName;
                cln.Email         = item.Email;
                cln.Gender        = item.Gender;
                cln.Nationality   = item.Nationality;
                cln.Address       = item.Address;
                cln.DateOfBirth   = item.DateOfBirth;
                cln.MobileNumber  = item.MobileNumber;
                cln.MaritalStatus = item.MaritalStatus;
                cln.Gender        = item.Gender;
                clientList.Add(cln);
            }

            return(clientList);
        }
Esempio n. 2
0
        public int DeleteClientById(int Id)
        {
            ClientEntities clnDb  = new ClientEntities();
            ClientInfo     clnDtl = new ClientInfo();

            clnDtl.pkclientId         = Id;
            clnDb.Entry(clnDtl).State = EntityState.Deleted;
            int Retval = clnDb.SaveChanges();

            return(Retval);
        }
Esempio n. 3
0
        public int UpdateClient(int Id, string FirstName, string LastName, string Email, string Nationality, string Address, string MobileNumber)
        {
            ClientEntities clnDb = new ClientEntities();
            ClientInfo     clnDl = new ClientInfo();

            clnDl.pkclientId   = Id;
            clnDl.FirstName    = FirstName;
            clnDl.Email        = Email;
            clnDl.Nationality  = Nationality;
            clnDl.Address      = Address;
            clnDl.LastName     = LastName;
            clnDl.MobileNumber = MobileNumber;

            clnDb.Entry(clnDl).State = EntityState.Modified;

            int Retval = clnDb.SaveChanges();

            return(Retval);
        }
Esempio n. 4
0
        public int AddClient(string FirstName, string LastName, string Email, string Nationality, string Address, string MobileNumber)
        {
            ClientEntities clnDb = new ClientEntities();
            ClientInfo     cln   = new ClientInfo();

            cln.FirstName = FirstName;
            cln.LastName  = LastName;
            cln.Email     = Email;

            cln.Nationality = Nationality;
            cln.Address     = Address;

            cln.MobileNumber = MobileNumber;


            clnDb.ClientInfoes.Add(cln);
            int Retval = clnDb.SaveChanges();

            return(Retval);
        }
Esempio n. 5
0
        public ClientInfo GetAllClientById(int id)
        {
            ClientEntities clnDb  = new ClientEntities();
            var            lstCln = from k in clnDb.ClientInfoes where k.pkclientId == id select k;
            ClientInfo     cln    = new ClientInfo();

            foreach (var item in lstCln)
            {
                cln.FirstName     = item.FirstName;
                cln.LastName      = item.LastName;
                cln.Email         = item.Email;
                cln.Gender        = item.Gender;
                cln.Nationality   = item.Nationality;
                cln.Address       = item.Address;
                cln.DateOfBirth   = item.DateOfBirth;
                cln.MobileNumber  = item.MobileNumber;
                cln.MaritalStatus = item.MaritalStatus;
                cln.Gender        = item.Gender;
            }

            return(cln);
        }