public Chat AddChat(Chat c) { using (SportsChatQueries query = new SportsChatQueries(new SportsChatEntities())) { query.AddChat(c); Chat newChat = query.GetChatByNameAndDateCreated(c.Name, c.DateCreated); return (newChat != null) ? newChat : null; } }
public void UpdateChat(Chat c) { ctx.Entry(c).State = System.Data.Entity.EntityState.Modified; try { ctx.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void AddChat(Chat c) { ctx.Chats.Add(c); try { ctx.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void RemoveChat(Chat c) { Chat chatToRemove = ctx.Chats.Find(c.Id); if (chatToRemove != null) { ctx.Chats.Remove(chatToRemove); } try { ctx.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }