public SearchController(IHM1Context appContext, IAppIdentityContext identityContext, ISearchService searchService) : base(appContext, identityContext, searchService) { }
public AccountController(IHM1Context appContext, IAppIdentityContext identityContext) : base(appContext, identityContext) { }
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()); }
public JournalPollManager(IHM1Context db) { _db = db; _queue = AppCore.IoC.Container.ResolveKeyed <IQueueManager>("ScheduledJournalQueue"); }