public ActionResult DeleteGroup(OrgGroupsModel m) { var group = DbUtil.Db.MemberTags.SingleOrDefault(g => g.Id == m.groupid); if (group != null) { DbUtil.Db.OrgMemMemTags.DeleteAllOnSubmit(group.OrgMemMemTags); DbUtil.Db.MemberTags.DeleteOnSubmit(group); DbUtil.Db.SubmitChanges(); m.groupid = (from v in m.Groups() where v.Value != "0" select v.Value).FirstOrDefault().ToInt(); ViewData["groupid"] = m.groupid.ToString(); } return(View("Form", m)); }
public ActionResult DeleteGroup(OrgGroupsModel m) { var group = CurrentDatabase.MemberTags.SingleOrDefault(g => g.Id == m.groupid); if (group != null) { CurrentDatabase.OrgMemMemTags.DeleteAllOnSubmit(group.OrgMemMemTags); CurrentDatabase.MemberTags.DeleteOnSubmit(group); CurrentDatabase.SubmitChanges(); m.groupid = (from v in m.Groups() where v.Value != "0" select v.Value).FirstOrDefault().ToInt(); ViewData["groupid"] = m.groupid.ToString(); } return(Redirect("/OrgGroups/Management/" + m.orgid)); }