Beispiel #1
0
        public void Add(
            string userId,
            string accountNo,
            string accountName,
            string waimaiAppId,
            string waimaiAppSecret,
            string tuangouAppKey,
            string tuangouAppSecret,
            string description)
        {
            var entity = new Mt_AccountEntity()
            {
                UserId           = userId,
                AccountNo        = accountNo,
                AccountName      = accountName,
                WaimaiAppId      = waimaiAppId,
                WaimaiAppSecret  = waimaiAppSecret,
                TuangouAppKey    = tuangouAppKey,
                TuangouAppSecret = tuangouAppSecret,
                Description      = description
            };

            using (var db = new O2OContext())
                new BaseService <Mt_AccountEntity>(db).Add(entity);
        }
Beispiel #2
0
        public void Update(
            Guid id,
            string userId,
            string accountNo,
            string accountName,
            string waimaiAppId,
            string waimaiAppSecret,
            string tuangouAppKey,
            string tuangouAppSecret,
            string description)
        {
            var mtAccountEntity = new Mt_AccountEntity()
            {
                UserId           = userId,
                AccountNo        = accountNo,
                AccountName      = accountName,
                WaimaiAppId      = waimaiAppId,
                WaimaiAppSecret  = waimaiAppSecret,
                TuangouAppKey    = tuangouAppKey,
                TuangouAppSecret = tuangouAppSecret,
                Description      = description
            };

            using (O2OContext db = new O2OContext())
            {
                BaseService <Mt_AccountEntity> baseService = new BaseService <Mt_AccountEntity>(db);
                Mt_AccountEntity entity = baseService.FirstOrDefault(a => a.Id == id) ?? throw new ArgumentNullException("ÕË»§²»´æÔÚ");
                entity.UserId           = userId;
                entity.AccountNo        = accountNo;
                entity.AccountName      = accountName;
                entity.WaimaiAppId      = waimaiAppId;
                entity.WaimaiAppSecret  = waimaiAppSecret;
                entity.TuangouAppKey    = tuangouAppKey;
                entity.TuangouAppSecret = tuangouAppSecret;
                entity.Description      = description;
                baseService.Update(entity);
            }
        }