// GET: Groups/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblGroups tblGroups = db.tblGroups.Find(id);

            if (tblGroups == null)
            {
                return(HttpNotFound());
            }

            GroupsViewModel    groupsViewModel    = new GroupsViewModel();
            ImplementedMethods implementedMethods = new ImplementedMethods();

            groupsViewModel.Name    = tblGroups.Name;
            groupsViewModel.PK_Id   = tblGroups.PK_Id;
            groupsViewModel.Actions = tblGroups.tblGroupActions.Select(s => new ActionsViewModel
            {
                PK_Id = s.PK_Id,
                Name  = s.ActionName
            }).ToList();

            ViewBag.AvailableActions = implementedMethods.ActiveMethods.Where(t => !db.tblGroupActions.Any(k => k.FK_Group == id && k.ActionName == t)).Select(s => new SelectListItem {
                Value = s, Text = s
            }).ToList();


            return(View(groupsViewModel));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            tblGroups tblGroups = db.tblGroups.Find(id);

            db.tblGroups.Remove(tblGroups);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "PK_Id,Name")] tblGroups tblGroups)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblGroups).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblGroups));
 }
        public ActionResult Create([Bind(Include = "PK_Id,Name")] tblGroups tblGroups)
        {
            if (ModelState.IsValid)
            {
                db.tblGroups.Add(tblGroups);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblGroups));
        }
        // GET: Groups/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblGroups tblGroups = db.tblGroups.Find(id);

            if (tblGroups == null)
            {
                return(HttpNotFound());
            }
            return(View(tblGroups));
        }