public bool AddNote(Note note, int ownerId) { if (note != null && CheckNotebookAccess(note.NotebookId, ownerId)) { _db.Notes.Add(note); _db.SaveChanges(); return(true); } return(false); }
public bool AddTodo(Todo todo, int ownerId) { if (todo != null && CheckTodoListAccess(todo.TodoListId, ownerId)) { _db.Todos.Add(todo); _db.SaveChanges(); return(true); } return(false); }
public bool AddCalendar(Calendar calendar) { if (calendar != null && !string.IsNullOrWhiteSpace(calendar.Title)) { _db.Calendars.Add(calendar); _db.SaveChanges(); return(true); } return(false); }
public bool AddNotebook(Notebook notebook) { if (notebook != null && !string.IsNullOrWhiteSpace(notebook.Title)) { _db.Notebooks.Add(notebook); _db.SaveChanges(); return(true); } return(false); }
public bool AddTodoList(TodoList todoList) { if (todoList != null && !string.IsNullOrWhiteSpace(todoList.Title)) { _db.TodoLists.Add(todoList); _db.SaveChanges(); return(true); } return(false); }
public bool AddUser(User user) { if (_db.Users.FirstOrDefault(u => u.Email == user.Email) != null || !new EmailAddressAttribute().IsValid(user.Email) || user.Password == "") { return(false); } _db.Add(user); _db.SaveChanges(); return(true); }
public bool AddEvent(Event e, int userId) { if (!CheckEventValidity(e) || !CheckCalendarAccess(e.CalendarId, userId)) { return(false); } _db.Add(e); _db.SaveChanges(); e.Calendar = null; return(true); }
public bool AddContact(Contact contact) { if (contact != null) { _db.Contacts.Add(contact); _db.SaveChanges(); return(true); } else { return(false); } }