// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. //Updates the lecturer public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Lecturer).State = EntityState.Modified; try { _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LecturerExists(Lecturer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. //Adds a module to the database. public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } _context.Module.Add(Module); _context.SaveChanges(); return(RedirectToPage("./Index")); }
//Deletes the allocation model uses a linq query to slect the allocation. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Allocation = (from allocation in _context.Allocation where allocation.Id == id select allocation).FirstOrDefault(); if (Allocation != null) { _context.Allocation.Remove(Allocation); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Removes the department uses a linq query to select the department. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Department = (from department in _context.Department where department.Id == id select department).FirstOrDefault(); if (Department != null) { _context.Department.Remove(Department); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Removes the module from db uses a linq query to select the module. public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Module = (from module in _context.Module where module.Id == id select module).FirstOrDefault(); if (Module != null) { _context.Module.Remove(Module); _context.SaveChanges(); } return(RedirectToPage("./Index")); }
//Deletes the lecturer from the databse uses a linq query to select the lecturer public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Lecturer = (from lecturer in _context.Lecturer where lecturer.Id == id select lecturer).FirstOrDefault(); if (Lecturer != null) { _context.Lecturer.Remove(Lecturer); _context.SaveChanges(); } return(RedirectToPage("./Index")); }