public EmailRegisterViewModel(CEClass ceClass) { Date = ceClass.Date; Time = ceClass.Time; Instructor = ceClass.Instructor; Type = ceClass.Type; ClassTitle = ceClass.ClassTitle; Description = ceClass.Description; }
public EditViewModel(CEClass ceClass) { Date = ceClass.Date; Time = ceClass.Time; Instructor = ceClass.Instructor; Type = ceClass.Type; ClassTitle = ceClass.ClassTitle; Description = ceClass.Description; MaxSize = ceClass.MaxSize; }
//We use IEnumerable<AppUser> since we need to get related data, which we can't get from IEnumerable<RegisteredAgent> public DetailViewModel(CEClass ceClass, IEnumerable <AppUser> registeredAgents) { Date = ceClass.Date; Time = ceClass.Time; Instructor = ceClass.Instructor; Type = ceClass.Type; ClassTitle = ceClass.ClassTitle; Description = ceClass.Description; SpotsLeft = (ceClass.MaxSize - registeredAgents.Count()); RegisteredAgents = registeredAgents; }
public IActionResult Add(ClassViewModel model) { if (ModelState.IsValid) { var ceClass = new CEClass(model); _repo.AddEntity(ceClass); _repo.SaveChanges(); ModelState.Clear(); return(Redirect("/CEClass/Classes")); } return(View()); }
public void RemoveClass(CEClass ceClass) { var removeClass = _context.CEClasses.Remove(ceClass); }