コード例 #1
0
 public void Add(UserDataModel model)
 {
     using (var context = DaoContextFactory.CreateContext())
     {
         UserStoreFactory.CreateUserDao(context)
         .AddUser(new UserModel
         {
             Name        = model.Name,
             Age         = model.Age,
             MailAddress = model.Mail,
         });
     }
 }
コード例 #2
0
        public IReadOnlyList <Models.UserDataModel> Find(UserFindModel model)
        {
            using (var context = DaoContextFactory.CreateContext())
            {
                var dao = UserStoreFactory.CreateUserDao(context);

                var users = dao.GetUsers(new UserFindParameter {
                    AgeLower = model.AgeLower,
                    AgeUpper = model.AgeUpper,
                });

                // DatastoreのDTOからBusinessLogicのDTOに変換
                return((from user in users
                        select new Models.UserDataModel
                {
                    Name = user.Name,
                    Age = user.Age,
                    Mail = user.MailAddress,
                }).ToList());
            }
        }