Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ZinternalcategoryId,internalsubcat")] Zinternalcategory zinternalcategory)
        {
            if (id != zinternalcategory.ZinternalcategoryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(zinternalcategory);
                    TempData["Alert"] = String.Format("Saved Changes to Internal Category: {0}", zinternalcategory.internalsubcat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ZinternalcategoryExists(zinternalcategory.ZinternalcategoryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(zinternalcategory));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("ZinternalcategoryId,internalsubcat")] Zinternalcategory zinternalcategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(zinternalcategory);
                TempData["Alert"] = String.Format("Added Internal Category: {0}", zinternalcategory.internalsubcat);
                await _context.SaveChangesAsync();

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