コード例 #1
0
        //udpate merely updates the repository a commit is required
        //to commit it to the db...
        private bool Update(NestedMenuItem item, string propertyName, object propertyValue)
        {//get the menuItem from the Repository List...
            MenuItem menuItem = MenuItemList.FirstOrDefault(q => q.AutoID == item.AutoID);

            //Set the edited field when present...
            if (!string.IsNullOrEmpty(propertyName))
            {
                menuItem.SetPropertyValue(propertyName, propertyValue);
            }
            //update the repository with the field change...
            _serviceAgent.UpdateMenuItemRepository(menuItem);
            Dirty = true;
            if (CommitIsAllowed())
            {
                AllowCommit = true;
            }
            else
            {
                AllowCommit = false;
            }
            return(AllowCommit);
        }