public ActionResult activateRoleRightActions(RoleRightsAction rightsAction) { if (!db.RoleRightsActions.Any(e => e.ActionId == rightsAction.ActionId && e.RoleRightId == rightsAction.RoleRightId)) { db.RoleRightsActions.Add(rightsAction); if (db.SaveChanges() > 0) { return(Json("Rights Awarded Successfully", JsonRequestBehavior.AllowGet)); } else { return(Json("Failed", JsonRequestBehavior.AllowGet)); } } else { return(Json("Already awarded", JsonRequestBehavior.AllowGet)); } }
public ActionResult deactivateRoleRightActions(RoleRightsAction rightsAction) { var rr = db.RoleRightsActions.FirstOrDefault(e => e.ActionId == rightsAction.ActionId && e.RoleRightId == rightsAction.RoleRightId); if (rr != null) { db.RoleRightsActions.Remove(rr); if (db.SaveChanges() > 0) { return(Json("Rights Awarded Revoked", JsonRequestBehavior.AllowGet)); } else { return(Json("Failed", JsonRequestBehavior.AllowGet)); } } else { return(Json("Already revoked", JsonRequestBehavior.AllowGet)); } }