Exemple #1
0
        public async Task <ActionResult <AccountNotes> > PostAccountNotes(AccountNotes accountNotes)
        {
            _context.AccountNotes.Add(accountNotes);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAccountNotes", new { id = accountNotes.AccountNotesId }, accountNotes));
        }
Exemple #2
0
        public async Task <IActionResult> EditAccountNotes(AccountNotes accountNotes)
        {
            var entity          = new AccountNotes();
            var accountNoteInDb = _context.AccountNotes.FirstOrDefault(r => r.AccountNotesId == accountNotes.AccountNotesId);

            if (accountNoteInDb == null)
            {
                _context.Add(accountNotes);
                _context.SaveChanges();
                return(Ok(entity));
            }
            else
            {
                accountNoteInDb.Notes = accountNotes.Notes;
                _context.SaveChanges();
                return(Ok(entity));
            }
        }