public bool DeleteRoom(int roomId, out string error) { error = string.Empty; try { var entity = DiscussionClassRoomRepository.GetById(roomId); if (entity == null) { error = "Room entity not found"; return(false); } DiscussionClassRoomRepository.Delete(entity); DiscussionClassRoomRepository.UnitOfWork.CommitAndRefreshChanges(); return(true); } catch (Exception ex) { error = Utils.FormatError(ex); Logger.Error("delete room", roomId, ex, CommonEnums.LoggerObjectTypes.Discussion); return(false); } }
public List <MessageViewDTO> GetHashtagFeed(string hashtag, DiscussionSortFields field, CommonEnums.SortDirections dir, out long?hashtagId, out string error) { error = string.Empty; hashtagId = null; try { hashtagId = FindHashtagByName(hashtag); if (hashtagId == null) { error = "Hashtag " + hashtag + " not found"; return(new List <MessageViewDTO>()); } var messages = DiscussionClassRoomRepository.GetHashtagMessages((long)hashtagId).Select(s => s.Entity2MessageViewDto()).ToList(); return(BuildMessageFeedTree(messages.ToArray(), field, dir)); } catch (Exception ex) { error = Utils.FormatError(ex); Logger.Error("get hashtag " + hashtag + " feed", null, ex, CommonEnums.LoggerObjectTypes.Discussion); return(new List <MessageViewDTO>()); } }
public List <MessageViewDTO> GetRoomMessages(int roomId, DiscussionSortFields field, CommonEnums.SortDirections dir) { try { var messages = DiscussionClassRoomRepository.GetRoomMessages(roomId).Select(s => s.Entity2MessageViewDto()).ToList(); return(BuildMessageFeedTree(messages.ToArray(), field, dir)); } catch (Exception ex) { Logger.Error("get room feed", roomId, ex, CommonEnums.LoggerObjectTypes.Discussion); return(new List <MessageViewDTO>()); } }
public DiscussionClassRoomDTO GetClassRoomDTO(int roomId) { return(roomId < 0 ? new DiscussionClassRoomDTO() : DiscussionClassRoomRepository.GetById(roomId).Entity2ClassRoomDto()); }
public List <AuthorRoomListDTO> GetAuthorClassRooms(int authorId) { return(DiscussionClassRoomRepository.GetAuthorRooms(authorId).Select(x => x.Entity2AuthorRoomListDto()).ToList()); }
public List <BaseListDTO> AuthorRoomsLOV(int authorId) { return(DiscussionClassRoomRepository.GetMany(x => x.AuthorId == authorId).Select(x => x.RoomEntity2BaseListDto()).ToList()); }