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; }
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; }
public virtual void SetUp() { this.unitOfWork = new UnitOfWork(); this.transaction = new Transaction(); this.Session = ServiceLocator.Current.GetInstance<ISession>(); }