public Note Edit(NoteEditDto noteDto) { try { noteDto.ModifiedDate = DateTime.Now; return(_noteRepository.Edit(noteDto)); } catch (Exception ex) { throw ex; } }
public Note Edit(NoteEditDto noteDto) { // Edit is tricky // With .Find() we get the "reference" of the record from the db Note note = _context.Notes.Find(noteDto.Id); // And we make the wanted changes on that reference note.Title = noteDto.Title; note.Description = noteDto.Description; note.DueDate = noteDto.DueDate; note.ModifiedDate = noteDto.ModifiedDate; _context.SaveChanges(); // And we should not forget to save those changes in the Database return(note); }
public Note Edit(NoteEditDto model) { return(_noteService.Edit(model)); }