public void OnGet()
 {
     using (var db = new SpartaDB())
     {
         CohortList = db.Cohort.ToList();
     }
 }
Example #2
0
 public void OnGet()
 {
     using (var db = new SpartaDB())
     {
         SpecialisationList = db.Specialisation.ToList();
     }
 }
Example #3
0
 public void OnGet()
 {
     using (var db = new SpartaDB())
     {
         RoleList = db.Role.ToList();
     }
 }
 public void OnGet()
 {
     using (var db = new SpartaDB())
     {
         UsersList = db.Users.ToList();
     }
 }
Example #5
0
 public void OnGet(int id)
 {
     using (var db = new SpartaDB())
     {
         var data = (from user in db.Users
                     where user.UsersID == id
                     select user).SingleOrDefault();
         UserSelected = data;
     }
 }
 public IActionResult OnPost()
 {
     using (var db = new SpartaDB())
     {
         if (ModelState.IsValid)
         {
             //   db.Users.Add(NewRole);
             return(RedirectToPage("/Users"));
         }
     }
     return(Page());
 }
Example #7
0
 public IActionResult OnPost()
 {
     using (var db = new SpartaDB())
     {
         if (ModelState.IsValid)
         {
             db.Role.Add(NewRole);
             db.SaveChanges();
             return(RedirectToPage("/Role"));
         }
     }
     return(Page());
 }
        public IActionResult OnGetDelete(int id)
        {
            if (id != null)
            {
                using (var db = new SpartaDB())
                {
                    var data = (from o in db.Users
                                where o.UsersID == id
                                select o).SingleOrDefault();

                    db.Remove(data);
                    db.SaveChanges();
                }
            }
            return(RedirectToPage("./Cohort"));
        }
        public void OnGet()
        {
            using (var db = new SpartaDB())
            {
                if (Request.Query.Count == 0)
                {
                    current = 1;
                }
                else
                {
                    current = Int32.Parse(Request.Query["page"]);
                }
                current = Math.Max(current, 1);
                current = Math.Min(3, current);

                UsersList = db.Users.ToList();
            }
        }
Example #10
0
 public EditSpecialisationModel(SpartaDB InjectedContext)
 {
     db = InjectedContext;
 }
 public EditRoleModel(SpartaDB InjectedContext)
 {
     db = InjectedContext;
 }
Example #12
0
 //Constructor to instantiate this db
 // Instantiate Northwind just once : use for Get() and Post()
 public CreateUserModel(SpartaDB InjectedContext)
 {
     db = InjectedContext;
 }
Example #13
0
 public EditUsersModel(SpartaDB InjectedContext)
 {
     db = InjectedContext;
 }
 public EditCohortModel(SpartaDB InjectedContext)
 {
     db = InjectedContext;
 }
 public ViewCohortModel(SpartaDB InjectedContext)
 {
     db = InjectedContext;
 }
Example #16
0
 public ViewUsersModel(SpartaDB InjectedContext)
 {
     db = InjectedContext;
 }
Example #17
0
 public LoginModel(SpartaDB context)
 {
     _context = context;
 }