Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Article_type article_type)
        {
            if (id != article_type.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Update(article_type);
                    await db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Article_typeExists(article_type.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(article_type));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Article_type article_type)
        {
            if (ModelState.IsValid)
            {
                db.Add(article_type);
                await db.SaveChangesAsync();

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