コード例 #1
0
        public SiteUser(EditUser user)

        {
            using (DatingContext db = new DatingContext())
            {
                this.password  = user.password;
                this.sessionId = user.sessionId;

                this.id = user.id;
                //this.avatarBase64 = avatarBase64;
                this.name     = user.name;
                this.email    = user.email;
                this.birthDay = user.birthDay;

                if (user.gender == "Male")
                {
                    this.gender = true;
                }
                else
                {
                    this.gender = false;
                }

                this.weight     = user.weight;
                this.height     = user.height;
                this.welcome    = user.welcome;
                this.roleid     = user.roleid;
                this.online     = user.online;
                this.dateOfEdit = user.dateOfEdit;


                string name = user.city;
                this.cityid = db.Cities.FirstOrDefault(x => x.cityName == name).id;

                name             = user.education;
                this.educationid = db.Education.FirstOrDefault(x => x.educationName == name).id;

                name = user.typeForSearch;
                this.typeForSearchid = db.TypeForSearch.FirstOrDefault(x => x.typeName == name).id;

                name = user.ageForSearch;
                this.ageForSearchid = db.AgeForSearch.FirstOrDefault(x => x.rangeOfAge == name).id;

                name = user.cityForSearch;
                this.cityForSearchid = db.Cities.FirstOrDefault(x => x.cityName == name).id;
            }
        }
コード例 #2
0
        public ClientUser(SiteUser user)

        {
            using (DatingContext db = new DatingContext())
            {
                this.id = user.id;
                //this.avatarBase64 = avatarBase64;
                this.name     = user.name;
                this.email    = user.email;
                this.birthDay = user.birthDay;

                if (user.gender)
                {
                    this.gender = "Male";
                }
                else
                {
                    this.gender = "Female";
                }



                this.weight     = user.weight;
                this.height     = user.height;
                this.welcome    = user.welcome;
                this.roleid     = user.roleid;
                this.online     = user.online;
                this.dateOfEdit = user.dateOfEdit;

                int id = user.cityid;
                this.city = db.Cities.FirstOrDefault(x => x.id == id).cityName;

                id             = user.educationid;
                this.education = db.Education.FirstOrDefault(x => x.id == id).educationName;

                id = user.typeForSearchid;
                this.typeForSearch = db.TypeForSearch.FirstOrDefault(x => x.id == id).typeName;

                id = user.ageForSearchid;
                this.ageForSearch = db.AgeForSearch.FirstOrDefault(x => x.id == id).rangeOfAge;

                id = user.cityForSearchid;
                this.cityForSearch = db.Cities.FirstOrDefault(x => x.id == id).cityName;
            }
        }