Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ID,Name,ShortName")] FederalDistrict federalDistrict)
        {
            if (ModelState.IsValid)
            {
                _context.Add(federalDistrict);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(federalDistrict));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ID,Body,Subject")] Article article)
        {
            if (ModelState.IsValid)
            {
                article.ID = Guid.NewGuid();
                _context.Add(article);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(article));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ID,Name,FederalDistrictID")] FederalSubject federalSubject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(federalSubject);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FederalDistrictID"] = new SelectList(_context.FederalDistricts, "ID", "ID", federalSubject.FederalDistrictID);
            return(View(federalSubject));
        }