Пример #1
0
 public EmailRegisterViewModel(CEClass ceClass)
 {
     Date        = ceClass.Date;
     Time        = ceClass.Time;
     Instructor  = ceClass.Instructor;
     Type        = ceClass.Type;
     ClassTitle  = ceClass.ClassTitle;
     Description = ceClass.Description;
 }
Пример #2
0
 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;
 }
Пример #3
0
 //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;
 }
Пример #4
0
        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());
        }
Пример #5
0
 public void RemoveClass(CEClass ceClass)
 {
     var removeClass = _context.CEClasses.Remove(ceClass);
 }