コード例 #1
0
ファイル: Common.cs プロジェクト: xuantranm/DigitalMarket
        public void UserTest()
        {
            var repoUser = new Repository<UserModel>(DbCollection.User);
            const string userName = "******";
            const string firstName = "Xuan";
            const string lastName = "Tran";
            const string profile = "profile";
            const string cover = "cover";
            for (var i = 0; i < 100; i++)
            {
                var user = new UserModel
                {
                    UserName = new StringBuilder().Append(userName).Append(i).ToString(),
                    Email = new StringBuilder().Append(userName).Append(i).Append("@gmail.com").ToString(),
                    PhoneNumber =
                        new StringBuilder().Append(MyConstants.nullDefault).Append(Guid.NewGuid()).Append("@null.null").ToString(),
                    FirstName = new StringBuilder().Append(firstName).Append(i).ToString(),
                    LastName = new StringBuilder().Append(lastName).Append(i).ToString(),
                    Created = DateTime.Now.ToString(),
                    Modified = DateTime.Now.ToString(),
                    Personal = true,
                    EmailConfirmed = true,
                    ProfilePictureSource = new StringBuilder().Append(profile).Append(" (" + i + ")").Append(".jpg").ToString(),
                    ProfilePicture = new StringBuilder().Append(profile).Append(" (" + i + ")").Append(".jpg").ToString(),
                    CoverPicture = new StringBuilder().Append(cover).Append(" (" + i + ")").Append(".jpg").ToString(),
                    CoverPictureSource = new StringBuilder().Append(cover).Append(" (" + i + ")").Append(".jpg").ToString(),
                    SecurityStamp = Guid.NewGuid().ToString(),
                    PasswordHash = "APGQcYeYZgmekR+U31R6D88kjEjyu8SkmGMJbZyeUEpDVwRfKgWIjwfxHIKfdY1law=="
                };
                repoUser.Insert(user);

                // INSERT Share db
                var repo = new Repository<ShareSettingModel>(DbCollection.ShareSetting);
                repo.Insert(new ShareSettingModel { UserId = user.Id.ToString() });
            }
        }
コード例 #2
0
 public ActionResult SettingFlName(UserModel model)
 {
     var repo = new Repository<UserModel>(DbCollection.User);
     var user = GetOwnerUser();
     user.FirstName = model.FirstName;
     user.LastName = model.LastName;
     user.Modified = DateTime.Now.ToString();
     repo.Update(user);
     return Json(new { result = true, model });
 }