Exemple #1
0
        public async Task <IActionResult> Create([Bind("ID,ClassName,Type,DuringTime,BurnCalories")] StudioClass studioClass)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studioClass);
                //FacebookAPI
                facebook(studioClass.ClassName);
                //FacebookAPI
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(studioClass));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("TrainersID,TrainerName,Seniority,PhoneNumber,Email")] Trainers trainers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(trainers);
                //FacebookAPI
                facebook(trainers.TrainerName);
                //FacebookAPI
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(trainers));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("LessonID,TrainerID,StudioClassID,MemberID,Capacity,LessonDay,LessonTime")] Lesson lesson)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lesson);
                //FacebookAPI
                facebook(lesson.LessonDay);
                //FacebookAPI
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StudioClassID"] = new SelectList(_context.StudioClass, "ID", "ID", lesson.StudioClassID);
            ViewData["TrainerID"]     = new SelectList(_context.Trainers, "TrainersID", "TrainersID", lesson.TrainerID);
            ViewData["MemberID"]      = new SelectList(_context.Members, "MembersID", "MembersID");
            return(View(lesson));
        }