Exemplo n.º 1
0
 //Gets the create allocation form.
 public IActionResult OnGet()
 {
     ViewData["DepartmentId"] = new SelectList(_context.Set <Department>(), "Id", "Name");
     ViewData["LecturerId"]   = new SelectList(_context.Set <Lecturer>(), "Id", "Name");
     ViewData["ModuleId"]     = new SelectList(_context.Set <Module>(), "Id", "Name");
     return(Page());
 }
Exemplo n.º 2
0
        //Gets the allocation for update using a lamda query
        public IActionResult OnGet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Allocation = _context.Allocation
                         .Include(a => a.Department)
                         .Include(a => a.Lecturer)
                         .Include(a => a.Module).FirstOrDefault(m => m.Id == id);

            if (Allocation == null)
            {
                return(NotFound());
            }
            ViewData["DepartmentId"] = new SelectList(_context.Set <Department>(), "Id", "Name", Allocation.DepartmentId);
            ViewData["LecturerId"]   = new SelectList(_context.Set <Lecturer>(), "Id", "Name", Allocation.LecturerId);
            ViewData["ModuleId"]     = new SelectList(_context.Set <Module>(), "Id", "Name", Allocation.ModuleId);
            return(Page());
        }