Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("PosId,PersonId,PosName,PosNote")] CcdPos ccdPos)
        {
            if (id != ccdPos.PosId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ccdPos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CcdPosExists(ccdPos.PosId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"] = new SelectList(_context.CcdPerson, "PersonId", "PersonName", ccdPos.PersonId);
            return(PartialView("~/Areas/CreditCard/Views/CcdPos/CreateEdit.cshtml", ccdPos));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("PosId,PersonId,PosName,PosNote")] CcdPos ccdPos)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ccdPos);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"] = new SelectList(_context.CcdPerson, "PersonId", "PersonName", ccdPos.PersonId);
            return(PartialView("~/Areas/CreditCard/Views/CcdPos/CreateEdit.cshtml", ccdPos));
        }