Exemplo n.º 1
0
        internal IFacadeUpdateResult <OpportunityData> DeleteOpportunity(object instanceId)
        {
            ArgumentValidator.IsNotNull("instanceId", instanceId);

            FacadeUpdateResult <OpportunityData> result = new FacadeUpdateResult <OpportunityData>();
            IOpportunityService service = UnitOfWork.GetService <IOpportunityService>();
            var query = service.Retrieve(instanceId);

            if (query.HasResult)
            {
                Opportunity instance  = query.ToBo <Opportunity>();
                var         saveQuery = instance.Delete();
                result.Merge(saveQuery);
            }
            else
            {
                AddError(result.ValidationResult, "OpportunityCannotBeFound");
            }

            return(result);
        }