public ActionResult Edit(CRUDWeeklyclassesViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            WeeklyClassesRepository repository = new WeeklyClassesRepository();

            WeeklyClasses weeklyClasses = new WeeklyClasses();

            weeklyClasses.Id = model.Id;


            weeklyClasses.Title      = model.Title;
            weeklyClasses.Content    = model.Content;
            weeklyClasses.Teacher    = model.Teacher;
            weeklyClasses.ImgURL     = model.ImgURL;
            weeklyClasses.FilesURL   = model.FilesURL;
            weeklyClasses.MeetingURL = model.MeetingURL;
            //  weeklyClasses.Teacher = model.Teacher;

            repository.Save(weeklyClasses);

            return(RedirectToAction("Index"));
        }
        public JsonResult GetGroups()
        {
            WeeklyClassesRepository repository = new WeeklyClassesRepository();

            List <WeeklyClasses> classes = repository.GetAll();

            return(new JsonResult {
                Data = classes, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public ActionResult Delete(CRUDWeeklyclassesViewModel model)
        {
            WeeklyClassesRepository repository = new WeeklyClassesRepository();

            if (model.Id.ToString() != String.Empty)
            {
                repository.Delete(model.Id);
            }


            return(RedirectToAction("Index"));
        }
        // GET: Events
        public ActionResult Index()
        {
            WeeklyClassesRepository repository    = new WeeklyClassesRepository();
            List <WeeklyClasses>    weeklyClasses = repository.GetAll();

            weeklyClasses.Reverse();

            WeeklyclassesListViewModel model = new WeeklyclassesListViewModel();

            model.WeeklyClasses = weeklyClasses;

            return(View(model));
        }
        public ActionResult Show(int id)
        {
            WeeklyClassesRepository repository = new WeeklyClassesRepository();

            WeeklyClasses weeklyClasses = repository.GetById(id);

            CRUDWeeklyclassesViewModel model = new CRUDWeeklyclassesViewModel();

            model.Title      = weeklyClasses.Title;
            model.Content    = weeklyClasses.Content;
            model.Teacher    = weeklyClasses.Teacher;
            model.ImgURL     = weeklyClasses.ImgURL;
            model.FilesURL   = weeklyClasses.FilesURL;
            model.MeetingURL = weeklyClasses.MeetingURL;
            //  model.Teacher = weeklyClasses.Teacher;


            return(View(model));
        }
        public ActionResult Edit(int?id)
        {
            WeeklyClassesRepository repository = new WeeklyClassesRepository();

            CRUDWeeklyclassesViewModel model = new CRUDWeeklyclassesViewModel();

            if (id.HasValue)
            {
                WeeklyClasses weeklyClasses = repository.GetById(id.Value);
                model.Id         = weeklyClasses.Id;
                model.Title      = weeklyClasses.Title;
                model.Content    = weeklyClasses.Content;
                model.Teacher    = weeklyClasses.Teacher;
                model.ImgURL     = weeklyClasses.ImgURL;
                model.FilesURL   = weeklyClasses.FilesURL;
                model.MeetingURL = weeklyClasses.MeetingURL;
                //  model.Teacher = weeklyClasses.Teacher;
            }

            return(View(model));
        }