-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHelpCommandsManager.cs
41 lines (39 loc) · 1.39 KB
/
HelpCommandsManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DarkwaterSupportBot
{
public class HelpCommandsManager
{
public static HelpCommandsEntities Help = new HelpCommandsEntities();
public static HelpCommand Search(string cmdName)
{
return Enumerable.FirstOrDefault(Help.HelpCommands, helpCommand => helpCommand.HelpName == cmdName);
}
public static void Add(HelpCommand cmd)
{
try
{
Help.HelpCommands.AddObject(cmd);
Help.SaveChanges();
}
catch (Exception e)
{
UtilityMethods.Print("Error occured in the adding method - " + e.InnerException.Data + e.InnerException + e.InnerException.Source + e.InnerException.Message + e.InnerException.StackTrace,true);
}
}
public static void Delete(HelpCommand cmd)
{
try
{
Help.HelpCommands.DeleteObject(cmd);
Help.SaveChanges();
}
catch (Exception e)
{
UtilityMethods.Print("Error occured in the deleting method - " + e.InnerException.Data + e.InnerException + e.InnerException.Source + e.InnerException.Message + e.InnerException.StackTrace,true);
}
}
}
}