public async Task <IActionResult> Index(/*[Bind("ID,MaintenanceDate,Scheduled,MaintenanceTime")]*/ AdminView admin) { if (ModelState.IsValid) { if (_context.AdminSettings.ToList().Count() != 0) { foreach (var item in _context.AdminSettings.ToList()) { _context.Remove(_context.AdminSettings.Single(m => m.ID == item.ID)); await _context.SaveChangesAsync(); } } AdminSettings AS = new AdminSettings { MaintenanceDate = admin.settingsAdmin.MaintenanceDate, MaintenanceTime = admin.settingsAdmin.MaintenanceTime, Scheduled = admin.settingsAdmin.Scheduled, }; await _context.AddAsync(AS); await _context.SaveChangesAsync(); AdminSettings.MaintenaceInfo = admin.settingsAdmin.MaintenanceDate; AdminSettings.ScheduledBool = admin.settingsAdmin.Scheduled; AdminSettings.MaintenaceTimeInfo = admin.settingsAdmin.MaintenanceTime; //Handle the other views here? return(RedirectToAction("Index")); } return(View(admin)); }