Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("CoId,CoName")] Countries countries)
        {
            if (ModelState.IsValid)
            {
                _context.Add(countries);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(countries));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("GnId,GnName")] Genres genres)
        {
            if (ModelState.IsValid)
            {
                _context.Add(genres);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(genres));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("CtId,CtName,CoId")] Cities cities)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cities);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CoId"] = new SelectList(_context.Countries, "CoId", "CoName", cities.CoId);
            return(View(cities));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("AuId,AuName,AuDateb,AuDated,AuCt,AuInfo")] Authors authors)
        {
            if (ModelState.IsValid)
            {
                _context.Add(authors);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AuCt"] = new SelectList(_context.Cities, "CtId", "CtName", authors.AuCt);
            return(View(authors));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> AddPerformance(int?id, [Bind("ThId,PrId,Info")] TheaterPerformances obj)
        {
            if (id != null)
            {
                ViewBag.Back = id;
            }

            if (ModelState.IsValid)
            {
                _context.Add(obj);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Performance", new { id = obj.ThId }));
            }
            ViewData["ThId"] = new SelectList(_context.Theaters, "ThId", "ThName", obj.ThId);
            ViewData["PrId"] = new SelectList(_context.Performance, "PrId", "PrName", obj.PrId);
            return(View(obj));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("PrId,PrName,PrYear,PrInfo")] Performance performance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(performance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(performance));
        }