public static void SeedHostDb(AngularDbContext context) { context.SuppressAutoSetTenantId = true; // Host seed new InitialHostDbBuilder(context).Create(); // Default tenant seed (in host database). new DefaultTenantBuilder(context).Create(); new TenantRoleAndUserBuilder(context, 1).Create(); }
public async Task <IHttpActionResult> GetPages(int?id = null) { using (var context = new AngularDbContext()) { var pages = await context.Pages.Where(p => p.Id == id || id == null).ToListAsync().ConfigureAwait(false); return(Ok(pages.Select(p => new { p.Title, p.Content }))); }; }
public IActionResult GetAllUsers() { try { var context = new AngularDbContext(); var result = (from u in context.User select u).ToList(); return(APIResponseCreator.GetResponse(ResponseCode.SUCCESS_CODE, "Success", result, System.Net.HttpStatusCode.OK)); } catch (Exception ex) { return(APIResponseCreator.GetResponse(ResponseCode.FAILED_CODE, ex.ToString(), null, System.Net.HttpStatusCode.OK)); } }
public async Task <IActionResult> RegisterUser(UserDTO dto) { try { if (string.IsNullOrEmpty(dto.Email) || string.IsNullOrEmpty(dto.FirstName) || string.IsNullOrEmpty(dto.LastName) || string.IsNullOrEmpty(dto.Password)) { return(APIResponseCreator.GetResponse(ResponseCode.Error_code, "Please provide all mandatory details.", null, System.Net.HttpStatusCode.OK)); } var user = new IdentityUser { Email = dto.Email, PhoneNumber = dto.ContactNumber, UserName = dto.Email }; var result = await _userManager.CreateAsync(user, dto.Password); if (result.Succeeded) { var context = new AngularDbContext(); var user1 = new User { FirstName = dto.FirstName, LastName = dto.LastName, Email = dto.Email, ContactNumber = dto.ContactNumber, Password = dto.Password, IsActive = true, AspnetUserId = user.Id }; context.User.Add(user1); context.SaveChanges(); return(APIResponseCreator.GetResponse(ResponseCode.SUCCESS_CODE, "Success", dto, System.Net.HttpStatusCode.OK)); } return(APIResponseCreator.GetResponse(ResponseCode.SUCCESS_CODE, result.Errors.FirstOrDefault().Description.ToString(), dto, System.Net.HttpStatusCode.OK)); } catch (Exception ex) { return(APIResponseCreator.GetResponse(ResponseCode.FAILED_CODE, ex.ToString(), null, System.Net.HttpStatusCode.OK)); } }
public SchoolRepository(AngularDbContext dbContext) { _dbContext = dbContext; }
public HostRoleAndUserCreator(AngularDbContext context) { _context = context; }
public DefaultEditionCreator(AngularDbContext context) { _context = context; }
public BookRepository(AngularDbContext dbContext) { _dbContext = dbContext; }
public MyMiddleware(RequestDelegate next, AngularDbContext dbContext) { _next = next; _dbContext = dbContext; }
public UnitOfWorkFilter(AngularDbContext dbContext, ILoggerFactory loggerFactory) { _dbContext = dbContext; _logger = loggerFactory.CreateLogger <UnitOfWorkFilter>(); }
public LibraryRepository(AngularDbContext context) { _dbContext = context; }
public InitialHostDbBuilder(AngularDbContext context) { _context = context; }
public HomeController(AngularDbContext dbContext) { _dbContext = dbContext; }
public DefaultTenantBuilder(AngularDbContext context) { _context = context; }
public DefaultSettingsCreator(AngularDbContext context) { _context = context; }
public SpGetUsersWithSearchAndFilter() { context = new AngularDbContext(); }
public ProductRepository(AngularDbContext dbContext) { _dbContext = dbContext; }
public ActivityRepository(AngularDbContext dbContext) { _dbContext = dbContext; }
public TenantRoleAndUserBuilder(AngularDbContext context, int tenantId) { _context = context; _tenantId = tenantId; }
public DefaultLanguagesCreator(AngularDbContext context) { _context = context; }
public ClassroomRepository(AngularDbContext dbContext) { _dbContext = dbContext; }