Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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
                })));
            };
        }
Exemplo n.º 3
0
 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));
     }
 }
Exemplo n.º 4
0
        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;
 }
Exemplo n.º 6
0
 public HostRoleAndUserCreator(AngularDbContext context)
 {
     _context = context;
 }
Exemplo n.º 7
0
 public DefaultEditionCreator(AngularDbContext context)
 {
     _context = context;
 }
Exemplo n.º 8
0
 public BookRepository(AngularDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Exemplo n.º 9
0
 public MyMiddleware(RequestDelegate next, AngularDbContext dbContext)
 {
     _next      = next;
     _dbContext = dbContext;
 }
Exemplo n.º 10
0
 public UnitOfWorkFilter(AngularDbContext dbContext, ILoggerFactory loggerFactory)
 {
     _dbContext = dbContext;
     _logger    = loggerFactory.CreateLogger <UnitOfWorkFilter>();
 }
Exemplo n.º 11
0
 public LibraryRepository(AngularDbContext context)
 {
     _dbContext = context;
 }
Exemplo n.º 12
0
 public InitialHostDbBuilder(AngularDbContext context)
 {
     _context = context;
 }
Exemplo n.º 13
0
 public HomeController(AngularDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Exemplo n.º 14
0
 public DefaultTenantBuilder(AngularDbContext context)
 {
     _context = context;
 }
Exemplo n.º 15
0
 public DefaultSettingsCreator(AngularDbContext context)
 {
     _context = context;
 }
Exemplo n.º 16
0
 public SpGetUsersWithSearchAndFilter()
 {
     context = new AngularDbContext();
 }
Exemplo n.º 17
0
 public ProductRepository(AngularDbContext dbContext)
 {
     _dbContext = dbContext;
 }
 public ActivityRepository(AngularDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Exemplo n.º 19
0
 public TenantRoleAndUserBuilder(AngularDbContext context, int tenantId)
 {
     _context  = context;
     _tenantId = tenantId;
 }
Exemplo n.º 20
0
 public DefaultLanguagesCreator(AngularDbContext context)
 {
     _context = context;
 }
 public ClassroomRepository(AngularDbContext dbContext)
 {
     _dbContext = dbContext;
 }