Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,LanguageId,Info_Name")] InfoName infoName)
        {
            if (ModelState.IsValid)
            {
                _context.Add(infoName);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(infoName));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CreateP([Bind("Id,InfoId,Textblock1")] TextBlock textBlock)
        {
            if (ModelState.IsValid)
            {
                _context.Add(textBlock);
                await _context.SaveChangesAsync();

                return(PartialView("_IndexName", new InfoViewModel()
                {
                    InfoNameVM = _context.InfoName.Where(s => s.Id == textBlock.InfoId).ToList(),
                    TextBlockVM = _context.TextBlock.Where(s => s.InfoId == textBlock.InfoId).ToList(),
                    PictureVM = _context.Picture.Where(s => s.InfoId == textBlock.InfoId).ToList()
                }));
            }
            ViewData["InfoId"] = new SelectList(_context.InfoName, "Id", "Id", textBlock.InfoId);
            return(PartialView("_IndexName", new InfoViewModel()
            {
                InfoNameVM = _context.InfoName.Where(s => s.Id == textBlock.InfoId).ToList(),
                TextBlockVM = _context.TextBlock.Where(s => s.InfoId == textBlock.InfoId).ToList(),
                PictureVM = _context.Picture.Where(s => s.InfoId == textBlock.InfoId).ToList()
            }));
        }