public virtual void AssignCustomActions(ActionType actionType, bool isGranted) { if (actionType == null) throw new FuelSecurityException(0, "عدم دسترسی مناسب"); if (this.CustomActions.Count(p => p.ActionTypeId == actionType.Id) > 0) { CustomActions.RemoveAll(pa => pa.ActionTypeId == actionType.Id); } var customAction = new PartyCustomAction(this.Id, actionType.Id, isGranted); CustomActions.Add(customAction); }
public void TestActionTypeInsertion() { ActionType actionType = new ActionType(1, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); using (var ctx = new DataContainer()) { ctx.ActionTypes.Add(actionType); ctx.SaveChanges(); } using (var ctx = new DataContainer()) { var insertedAction = ctx.ActionTypes.Single(a => a.Id == 1); Assert.AreEqual(insertedAction.Name, actionType.Name); Assert.AreEqual(insertedAction.Description, actionType.Description); } }