public int DeleteMessage(int messageId) { int i = 0; using (SqlCommand command = new SqlCommand()) { i = ExecuteNonQuery(MessageStringsSql.DeleteMessage(messageId)); } return(i); }
public int DeleteMessageByUser(string userId) { int i = 0; using (SqlCommand command = new SqlCommand()) { i = ExecuteNonQuery(MessageStringsSql.DeleteMessageByUser(userId)); } return(i); }
public List <MessageModel> GetAllMessages() { DataTable dt = new DataTable(); List <MessageModel> arrMessage = new List <MessageModel>(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(MessageStringsSql.GetAllMessages()); } foreach (DataRow ms in dt.Rows) { arrMessage.Add(MessageModel.ToObject(ms)); } return(arrMessage); }
public MessageModel GetOneMessageById(int messageId) { DataTable dt = new DataTable(); MessageModel message = new MessageModel(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(MessageStringsSql.GetOneMessageById(messageId)); } foreach (DataRow ms in dt.Rows) { message = MessageModel.ToObject(ms); } return(message); }