Example #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Title,TableName,IdTab")] SsmsColumn ssmsColumn)
        {
            if (id != ssmsColumn.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ssmsColumn);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SsmsColumnExists(ssmsColumn.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdTab"] = new SelectList(_context.SsmsTable, "Id", "Id", ssmsColumn.IdTab);
            return(View(ssmsColumn));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Id,Title,TableName,IdTab")] SsmsColumn ssmsColumn)
        {
            if (ModelState.IsValid)
            {
                ssmsColumn.Id = Guid.NewGuid();
                _context.Add(ssmsColumn);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdTab"] = new SelectList(_context.SsmsTable, "Id", "Id", ssmsColumn.IdTab);
            return(View(ssmsColumn));
        }