public long InsertOrUpdateNote(Note note) { try { noteRepository.InsertOrUpdateNote(note); return note.NoteID; } catch (Exception ex) { throw ex; } }
public long InsertOrUpdateNote(Note note) { try { context.Entry(note).State = note.NoteID == 0 ? EntityState.Added : EntityState.Modified; SaveChanges(); return note.NoteID; } catch (Exception ex) { throw ex; } }