Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("NoteId,NoteAccountId,Account,Password,Platform,Phone,EnteringStaff,Branch,Note")] PsnNote psnNote)
        {
            if (id != psnNote.NoteId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(psnNote);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PsnNoteExists(psnNote.NoteId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { id = psnNote.NoteAccountId }));
            }
            return(PartialView("~/Areas/Personnel/Views/PsnNote/CreateEdit.cshtml", psnNote));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("NoteId,NoteAccountId,Account,Password,Platform,Phone,EnteringStaff,Branch,Note")] PsnNote psnNote)
        {
            if (ModelState.IsValid)
            {
                _context.Add(psnNote);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), new { id = psnNote.NoteAccountId }));
            }
            return(PartialView("~/Areas/Personnel/Views/PsnNote/CreateEdit.cshtml", psnNote));
        }