Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Idlcr,Name,Description")] Lcr lcr)
        {
            if (id != lcr.Idlcr)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lcr);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LcrExists(lcr.Idlcr))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lcr));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Idlcr,Name,Description")] Lcr lcr)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lcr);
                await _context.SaveChangesAsync();

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