public bool changeForumPolicy(int maxNumOfAdmins, int minNumOfAdmins, int maxNumOfModerators, int minNumOfModerators, string forumName, int pdp, int passLife, int moderatorSen, int mup) { bool success = false; try { ForumPolicy fp = db.ForumPolicies.FirstOrDefault(p => p.forumName == forumName); fp.maxNumOfAdmins = maxNumOfAdmins; fp.minNumOfAdmins = minNumOfAdmins; fp.maxNumOfModerators = maxNumOfModerators; fp.minNumOfModerators = minNumOfModerators; fp.forumName = forumName; fp.pdp = pdp; fp.passwordLifespan = passLife; fp.moderatorSeniority = moderatorSen; fp.mup = mup; db.SaveChanges(); success = true; } catch { } return(success); }
public bool addForumPolicy(int maxNumOfAdmins, int minNumOfAdmins, int maxNumOfModerators, int minNumOfModerators, string forumName, int pdp, int passLife, int moderatorSen, int mup) { bool success = false; ForumPolicy fp = new ForumPolicy(); fp.maxNumOfAdmins = maxNumOfAdmins; fp.minNumOfAdmins = minNumOfAdmins; fp.maxNumOfModerators = maxNumOfModerators; fp.minNumOfModerators = minNumOfModerators; fp.forumName = forumName; fp.pdp = pdp; fp.passwordLifespan = passLife; fp.moderatorSeniority = moderatorSen; fp.mup = mup; try { db.ForumPolicies.Add(fp); db.SaveChanges(); success = true; } catch { success = false; } return(success); }