Example #1
0
        public EssenceSOR <Immovables> CancelEdit()
        {
            var operationResult = new EssenceSOR <Immovables>();

            try
            {
                var tempIr = new ImmoRepos();
                var d      = tempIr.LoadByLinq(x => x.Id == immoEdit.Id).First();
                foreach (PropertyInfo myProp in ImmoProperty)
                {
                    string propName = myProp.Name;
                    foreach (PropertyInfo oldProp in ImmoProperty)
                    {
                        string oldpropName = oldProp.Name;
                        if (propName == oldpropName)
                        {
                            myProp.SetValue(immoEdit, oldProp.GetValue(d));
                        }
                    }
                }
                operationResult.Essence = immoEdit;
                return(operationResult);
            }
            catch (Exception e)
            {
                operationResult.Message   = e.Message;
                operationResult.IsSuccess = true;
            }
            return(operationResult);
        }