Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ZreasonId,final_reason,report,active,status_match")] Zreason zreason)
        {
            if (id != zreason.ZreasonId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(zreason);
                    TempData["Alert"] = String.Format("Saved Changes to Reason: {0}", zreason.final_reason);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ZreasonExists(zreason.ZreasonId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(zreason));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("ZreasonId,final_reason,report,active,status_match")] Zreason zreason)
        {
            if (ModelState.IsValid)
            {
                _context.Add(zreason);
                TempData["Alert"] = String.Format("Added Reason: {0}", zreason.final_reason);
                await _context.SaveChangesAsync();

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