/// <summary> /// Read In all conversations. This may primarily be useful for auditing purposes. /// </summary> /// <returns></returns> public IEnumerable <Conversations1> ReadInConversations() { var getCx = from cx in ADC.Conversations select MapConversations.Map(cx); return(getCx); }
/// <summary> /// Read in all conversations associated with that DEPTID. /// </summary> /// <param name="id"></param> /// <returns></returns> public IEnumerable <Conversations1> ReadInConversationByConversationID(int id) { var getCx = from cx in ADC.Conversations where cx.ID == id select MapConversations.Map(cx); return(getCx); }
/// <summary> /// Read in all conversations associated with that user id. /// </summary> /// <param name="id"></param> /// <returns></returns> public IEnumerable <Conversations1> ReadInConversationsByAccountID(int id) { var getCx = from cx in ADC.Conversations where cx.ACCOUNT_ID == id select MapConversations.Map(cx); return(getCx); }
/// <summary> /// Check Access level of user and allow that user to only see messages with that level of access. /// </summary> /// <param name="ConvType"></param> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> public IEnumerable <Conversations1> ReadInConversationByConversationType( int ConvType, string username, string password ) { var user = ADC.Accounts.FirstOrDefault(e => e.USERNAME == username && e.PASSWORD == password); if (user == null) { Console.WriteLine($"Cx with username and password combination doesn't exist"); return(null); } var getCx = from cx in ADC.Conversations where cx.CONVERSATION_TYPE == ConvType where cx.ACCESS_LEVEL <= user.ACCESS_LEVEL select MapConversations.Map(cx); return(getCx); }
public void CreateConversation(Conversations1 Conversation) { ADC.Conversations.Add(MapConversations.Map(Conversation)); // this will generate insertMapper.Map(Conversations) ADC.SaveChanges(); // this will execute the above generate insert query }