private void ResetDatabase() { var entities = new moodywebEntities(); var objCtx = ((System.Data.Entity.Infrastructure.IObjectContextAdapter)entities).ObjectContext; objCtx.ExecuteStoreCommand("TRUNCATE TABLE tbl_moody"); }
private void UpdateDatabase(string participantId, int vote, string message, DateTime timestamp) { var entities = new moodywebEntities(); if (vote == 0) { participantId = "0"; } var mood = new tbl_moody { participant_id = participantId, event_id = 0, comment = message, vote = vote, time = timestamp }; entities.tbl_moody.Add(mood); entities.SaveChanges(); }