public int AddNote(string noteName, string htmlContent, string shortNote) { var manager = new NotesManagerDataAccess(); var note = new Notes {Name = noteName, HTML = htmlContent, ShortNote = shortNote}; return manager.AddNote(note); }
public int AddNote(Notes note) { using (var context = new MiniCMSEntities()) { if (IsExistName(note.Name, context)) throw new InvalidOperationException("This name is already used"); context.Notes.Add(note); context.SaveChanges(); return note.Id; } }