Пример #1
0
        public UserProfileENT UpdateSelectSingle(UserProfileENT Obj)
        {
            NbkDbEntities dbcontext = new NbkDbEntities();
            Users         Data      = new Users()
            {
                Id          = Obj.Id,
                Designation = Obj.Designation,
                IsActive    = Obj.IsActive,
                Password    = Obj.Password,
                Picture     = Obj.Picture,
                UserName    = Obj.UserName,
                UserTypeId  = Obj.UserTypeId,
                ContactId   = Obj.ContactId
            };


            dbcontext.Users.Attach(Data);
            var update = dbcontext.Entry(Data);

            update.Property(x => x.Designation).IsModified = true;
            update.Property(x => x.IsActive).IsModified    = true;
            update.Property(x => x.Password).IsModified    = true;
            update.Property(x => x.Picture).IsModified     = true;
            update.Property(x => x.UserName).IsModified    = true;
            update.Property(x => x.UserTypeId).IsModified  = true;
            update.Property(x => x.ContactId).IsModified   = true;

            dbcontext.SaveChanges();

            return(Obj);
        }
Пример #2
0
        public WrapperUserProfile CreateSingleUserProfile(UserProfileENT UserProfile)
        {
            WrapperUserProfile data = new WrapperUserProfile();

            data.UserProfile = new UserProfileCRUD().CreateSingle(UserProfile);
            return(data);
        }
Пример #3
0
        public UserProfileENT SelectSingle(int Id)
        {
            NbkDbEntities  dbcontext = new NbkDbEntities();
            Users          Obj       = dbcontext.Users.Where(x => x.Id == Id).FirstOrDefault();
            UserProfileENT Data      = new UserProfileENT()
            {
                Id          = Obj.Id,
                Designation = Obj.Designation,
                IsActive    = Obj.IsActive,
                Password    = Obj.Password,
                Picture     = Obj.Picture,
                UserName    = Obj.UserName,
                UserTypeId  = Obj.UserTypeId,
                ContactId   = Obj.ContactId
            };

            return(Data);
        }
Пример #4
0
        public UserProfileENT SearchUserByEmail(string email)
        {
            NbkDbEntities dbcontext   = new NbkDbEntities();
            Project       ObjProj     = dbcontext.Project.FirstOrDefault();
            ContactBook   UserContact = dbcontext.ContactBook.Where(x => x.Email == email).FirstOrDefault();

            Users          Obj  = dbcontext.Users.Where(x => x.ContactId == UserContact.Id).FirstOrDefault();
            UserProfileENT Data = new UserProfileENT()
            {
                Id          = Obj.Id,
                Designation = Obj.Designation,
                IsActive    = Obj.IsActive,
                Password    = Obj.Password,
                Picture     = Obj.Picture,
                UserName    = Obj.UserName,
                UserTypeId  = Obj.UserTypeId,
                ContactId   = Obj.ContactId
            };

            return(Data);
        }
Пример #5
0
        public UserProfileENT CreateSingle(UserProfileENT Obj)
        {
            NbkDbEntities dbcontext = new NbkDbEntities();
            Users         Data      = new Users()
            {
                Designation = Obj.Designation,
                IsActive    = Obj.IsActive,
                Password    = Obj.Password,
                Picture     = Obj.Picture,
                UserName    = Obj.UserName,
                UserTypeId  = Obj.UserTypeId,
                ContactId   = Obj.ContactId
            };


            dbcontext.Users.Add(Data);
            dbcontext.SaveChanges();

            Obj.Id = Data.Id;

            return(Obj);
        }