public BackOfficeNode GetBackOfficeNodeDetails(int contentId, int userId) { var _result = new BackOfficeNode(); var _note = new NoteViewModel(); // Step 1: Get the content node details var _content = Services.ContentService.GetById(contentId); if (_content == null) { throw new ArgumentNullException("contentId"); } _result.ContentId = contentId; _result.ContentName = _content.Name; foreach (var prop in _content.Properties.Where(p => p.PropertyType.PropertyEditorAlias == "Notely")) { var dataTypeDef = Services.DataTypeService.GetDataTypeDefinitionById( prop.PropertyType.DataTypeDefinitionId); var limitValue = int.Parse(GetPreValues(dataTypeDef)["limit"].ToString()); // Step 2: Add properties and notes _result.Properties.Add(new BackOfficeProperty() { Alias = prop.Alias, Id = prop.PropertyType.Id, Name = prop.PropertyType.Name, Limit = limitValue, Notes = userId >= 0 ? NotelyContext.Current.Services.NoteService.GetAll( _content.Id, prop.PropertyType.Id, userId) .Select(c => _note.Convert(c)).ToList() : NotelyContext.Current.Services.NoteService.GetAll( _content.Id, prop.PropertyType.Id) .Select(c => _note.Convert(c)).ToList() }); } return(_result); }
public NoteViewModel GetNote(int id) { var noteVm = new NoteViewModel(); return(noteVm.Convert(NotelyContext.Current.Services.NoteService.GetById(id))); }
public IEnumerable <NoteViewModel> GetAllNotes() { var noteVm = new NoteViewModel(); return(NotelyContext.Current.Services.NoteService.GetAll().Select(c => noteVm.Convert(c))); }
public IEnumerable <NoteViewModel> GetMyTasks(int userId) { var noteVm = new NoteViewModel(); return(NotelyContext.Current.Services.NoteService.GetAllByAssignee(userId).Select(c => noteVm.Convert(c))); }
public IEnumerable <NoteViewModel> GetNotes(int contentId, int propertyDataId, string propertyTypeAlias) { var _propertyVM = new ContentPropertyViewModel() { ContentId = contentId, PropertyDataId = propertyDataId, PropertyTypeAlias = propertyTypeAlias }; var noteVm = new NoteViewModel(); if (_propertyVM.ContentId > 0 && _propertyVM.PropertyDataId > 0) { var _content = Services.ContentService.GetById(_propertyVM.ContentId); var _property = _content.Properties.FirstOrDefault( p => p.Id == _propertyVM.PropertyDataId || p.Alias.Equals(_propertyVM.PropertyTypeAlias) ); return(NotelyContext.Current.Services.NoteService.GetAll( _propertyVM.ContentId, _property != null ? _property.PropertyType.Id : -1).Select(c => noteVm.Convert(c))); } else { return(null); } }