Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] CourseType courseType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courseType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(courseType));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Desc,CourseTypeId,CenterId")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CenterId"]     = new SelectList(_context.Center, "Id", "Id", course.CenterId);
            ViewData["CourseTypeId"] = new SelectList(_context.CourseType, "Id", "Id", course.CourseTypeId);
            return(View(course));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,StartTime,EndTime,WeekdayId,CourseId")] CourseTime courseTime)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courseTime);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"]  = new SelectList(_context.Course, "Id", "Id", courseTime.CourseId);
            ViewData["WeekdayId"] = new SelectList(_context.Weekday, "Id", "Id", courseTime.WeekdayId);
            return(View(courseTime));
        }
Esempio n. 4
0
 public void Add(CourseTime courseTime)
 {
     _context.Add(courseTime);
 }
Esempio n. 5
0
 public void Add(Weekday weekday)
 {
     _context.Add(weekday);
 }
Esempio n. 6
0
 public void Add(CourseType courseType)
 {
     _context.Add(courseType);
 }
Esempio n. 7
0
 public void Add(Center center)
 {
     _context.Add(center);
 }