public UserWithRolesController(SeboDbContext context, UserManager <IdentityUser> userManager
                                , SignInManager <IdentityUser> signInManager
                                , RoleManager <IdentityRole> roleManager)
 {
     _context       = context;
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
 }
Пример #2
0
        public static IQueryable <Course> CourseName(SeboDbContext _context, params string[] keywords)
        {
            IQueryable <Course> query = from q in _context.Course select q;

            foreach (string keyword in keywords)
            {
                string temp = keyword;
                query = query.Where(p => p.CourseName.Contains(temp));
            }
            return(query);
        }
Пример #3
0
        public static IQueryable <Course> SearchCourseName(SeboDbContext _context, params string[] keywords)
        {
            var predicate = PredicateBuilder.False <Course>();

            foreach (string keyword in keywords)
            {
                string temp = keyword;
                predicate = predicate.Or(p => p.CourseName.Contains(temp));
            }
            return((from s in _context.Course select s).Where(predicate));
        }
Пример #4
0
        public static void Initialize(SeboDbContext context)
        {
            //    context.Database.EnsureCreated();

            //    //Ckecking whether exist records in the table
            //    if (context.Category.Any())
            //    {
            //        return;
            //    }

            //    //*
            //    // If there is no record the table is initialized
            //    //
            //    var Categories = new Category[]
            //    {
            //        new Category{ CategoryName ="Action"},
            //        new Category{ CategoryName ="Adult"},
            //        new Category{ CategoryName ="Adventure"},
            //        new Category{ CategoryName ="Animation"},
            //        new Category{ CategoryName ="Anime"},
            //        new Category{ CategoryName ="Biography"},
            //        new Category{ CategoryName ="Cartoon"},
            //        new Category{ CategoryName ="Comedy"},
            //        new Category{ CategoryName ="Comedy Drama"},
            //        new Category{ CategoryName ="Comedy-Romance"},
            //        new Category{ CategoryName ="Crime"},
            //        new Category{ CategoryName ="Documentary"},
            //        new Category{ CategoryName ="Drama"},
            //        new Category{ CategoryName ="Fantasy"},
            //        new Category{ CategoryName ="Horror"},
            //        new Category{ CategoryName ="Martial-Arts"},
            //        new Category{ CategoryName ="Musical"},
            //        new Category{ CategoryName ="Mystery"},
            //        new Category{ CategoryName ="Reality-TV"},
            //        new Category{ CategoryName ="Romance"},
            //        new Category{ CategoryName ="Scifi"},
            //        new Category{ CategoryName ="Sport"},
            //        new Category{ CategoryName ="Superhero"},
            //        new Category{ CategoryName ="Talk Show"},
            //        new Category{ CategoryName ="Thriller"},
            //        new Category{ CategoryName ="TV Series"},
            //        new Category{ CategoryName ="TV Shows"},
            //        new Category{ CategoryName ="War"},
            //        new Category{ CategoryName ="Western"}
            //    };

            //    foreach (Category c in Categories)
            //    {
            //        context.Category.Add(c);

            //    }

            //    context.SaveChanges();
        }
Пример #5
0
        public static int GetUserId(string UserName, SeboDbContext _context)
        {
            var user = (from s in _context.User where s.UserName == UserName select s.UserId).ToList();

            if (user.Count() > 0)
            {
                return(user[0]);
            }
            else
            {
                return(-1);
            }
        }
Пример #6
0
        public static IQueryable <Book> SearchBook(SeboDbContext _context, string sortOrder = "title_asc", params string[] keywords)
        {
            IQueryable <Book> books = (from b in _context.Book select b);

            if (keywords.Length > 0)
            {
                var predicate = PredicateBuilder.False <Book>();
                foreach (string keyword in keywords)
                {
                    string temp = keyword;
                    predicate = predicate.Or(p => p.Title.Contains(temp)).Or(p => p.Description.Contains(temp)).Or(p => p.ISBN.Contains(temp));
                }
                books = (from b in _context.Book select b).Where(predicate);
            }

            books = OrderingBooks.Do(books, sortOrder);
            return(books);
        }
Пример #7
0
 public BookConditionsController(SeboDbContext context)
 {
     _context = context;
 }
Пример #8
0
 public InstitutionsController(SeboDbContext context)
 {
     _context = context;
 }
Пример #9
0
 public LocalizationsController(SeboDbContext context)
 {
     _context = context;
 }
Пример #10
0
 public BooksController(SeboDbContext context)
 {
     _context = context;
 }
Пример #11
0
 public OrdersController(SeboDbContext context)
 {
     _context = context;
 }
 public CustomerServicesController(SeboDbContext context)
 {
     _context = context;
 }
Пример #13
0
 public AlertsController(SeboDbContext context)
 {
     _context = context;
 }
Пример #14
0
 public CoursesController(SeboDbContext context)
 {
     _context = context;
 }
Пример #15
0
 public HomeController(SeboDbContext context)
 {
     _context = context;
 }
Пример #16
0
 public ClaimsController(SeboDbContext context)
 {
     _context = context;
 }
 public StudyAreasController(SeboDbContext context)
 {
     _context = context;
 }
Пример #18
0
        public static IQueryable <Book> SearchBooks(SeboDbContext _context, params string[] keywords)
        {
            string sortOrder = "title_asc";

            return(SearchBook(_context, sortOrder, keywords));
        }
Пример #19
0
 public ClaimMediationsController(SeboDbContext context)
 {
     _context = context;
 }