コード例 #1
0
 public SearchController(IHM1Context appContext, IAppIdentityContext identityContext, ISearchService searchService)
     : base(appContext, identityContext, searchService)
 {
 }
コード例 #2
0
 public AccountController(IHM1Context appContext, IAppIdentityContext identityContext)
     : base(appContext, identityContext)
 {
 }
コード例 #3
0
        public async Task <IHttpActionResult> Register(RegisterRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            //using (TransactionScope scope = new TransactionScope())
            {
                IHM1Context db = AppCore.IoC.Container.Resolve <IHM1Context>();

                try
                {
                    AppTenant tenant = new AppTenant();
                    tenant.Name = model.PropertyName;
                    var user = new AppUser()
                    {
                        UserName = model.Email, Email = model.Email
                    };
                    user.AppTenants.Add(tenant);

                    IdentityResult result = await UserManager.CreateAsync(user, model.Password);

                    if (!result.Succeeded)
                    {
                        //scope.Dispose();
                        return(GetErrorResult(result));
                    }

                    var tenantParty = new Party()
                    {
                        AppTenantID = tenant.ID, Name = model.PropertyName, PartyType = "C"
                    };
                    var region        = db.Regions.Single(x => x.Code == "BC"); //temp
                    var tentantEntity = new AccountingEntity()
                    {
                        AppTenantID = tenant.ID, Party = tenantParty, Region = region
                    };
                    db.AccountingEntities.Add(tentantEntity);

                    var userParty = new Party()
                    {
                        AppTenantID = tenant.ID, FirstName = model.FirstName, Surname = model.Surname, PartyType = "I"
                    };
                    var userParticipant = new Participant()
                    {
                        AppTenantID = tenant.ID, Party = userParty
                    };

                    db.Participants.Add(userParticipant);

                    await db.SaveChangesAsync();

                    //scope.Complete();
                }
                catch (Exception ex)
                {
                    //scope.Dispose();
                    throw ex;
                }
            }

            return(Ok());
        }
コード例 #4
0
 public JournalPollManager(IHM1Context db)
 {
     _db    = db;
     _queue = AppCore.IoC.Container.ResolveKeyed <IQueueManager>("ScheduledJournalQueue");
 }