public void Search() { if (string.IsNullOrEmpty(RequestedValue)) { MaximumInQueue = Schools.Count(); QueueRange = Range.CalculateFromDivider(RequestedCount, Schools.Count(), RequestedPage); Result = GetAllFromRange(QueueRange); } else { List <Tenant> Matches = GetAllMatches(ref RequestedValue); QueueRange = Range.CalculateFromDivider(RequestedCount, Matches.Count, RequestedPage); MaximumInQueue = Matches.Count; Result = Matches.Skip(QueueRange.Min).Take(QueueRange.Max - QueueRange.Min).ToList(); } }
public VSContext(DbContextOptions options) : base(options) { Database.EnsureCreated(); //инициализация стартовыми данными if (Schools.Count() == 0) { Object math = new Object() { ObjectName = "Математика" }; Object russ = new Object() { ObjectName = "Русский язык" }; Object info = new Object() { ObjectName = "Информатика" }; Object physic = new Object() { ObjectName = "Физика" }; Object window = new Object() { ObjectName = "Окно" }; Role student = new Role() { RoleName = "student" }; Role admin = new Role() { RoleName = "admin" }; School school = new School() { SchoolNumber = 9, }; Class _class = new Class() { ClassChar = "А", ClassNumber = 10, School = school, }; Schools.Add(school); Classes.Add(_class); Objects.Add(info); Objects.Add(window); Objects.Add(physic); Objects.Add(math); Objects.Add(russ); Roles.Add(student); Roles.Add(admin); SaveChanges(); } }