示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Text,Subject,URLImage")] Sag sag)
        {
            if (id != sag.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sag);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SagExists(sag.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sag));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Text,Subject,URLImage")] Sag sag)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sag);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sag));
        }
示例#3
0
        private void Sager_Click(object sender, EventArgs e)
        {
            Form f = new Sag();

            f.Show();
        }