Inheritance: IDisposable
コード例 #1
0
        public long EditUser(UserModel model)
        {
            Contract.Assert(model.UserId.HasValue);

            var user = this.Manager.Load(model.UserId.Value);
            var role = this.RoleManager.Load(model.RoleId);

            PartnerEntity partner = null;
            if (model.PartnerId.HasValue)
            {
                partner = this.PartnerManager.Load(model.PartnerId.Value);
            }

            user.Name = model.Name;
            user.Email = model.Email;
            user.UserPasswordCredential.Login = model.Login;
            user.Role = role;
            user.Partner = partner;

            using (var tx = new Transaction())
            {
                this.Manager.Update(user);

                tx.Complete();
            }

            return user.Id;
        }
コード例 #2
0
        public long UpdatePartner(PartnerModel model)
        {
            Contract.Assert(model.PartnerId.HasValue);

            var partner = this.Manager.Load(model.PartnerId.Value);

            partner.Name = model.Name;
            partner.Disabled = model.Disabled;

            using (var tx = new Transaction())
            {
                this.Manager.Update(partner);

                tx.Complete();
            }

            return partner.Id;
        }
コード例 #3
0
 public virtual void SetUp()
 {
     this.unitOfWork = new UnitOfWork();
     this.transaction = new Transaction();
     this.Session = ServiceLocator.Current.GetInstance<ISession>();
 }