public static void ExecuteMethod_RemovePortfolio(Portfolio portfolio) { if (portfolio == null) { return; } var collection = PortfolioCollection.RetrieveFromOwnerContent(InformationContext.Current.Owner, "default"); var item = collection.CollectionContent.FirstOrDefault(x => x.ID == portfolio.ID); collection.CollectionContent.Remove(item); portfolio.DeleteInformationObject(); collection.StoreInformation(); }
public static Portfolio GetTarget_Portfolio(string id) { if (string.IsNullOrEmpty(id)) { var portfolio = new Portfolio(); portfolio.SetLocationAsOwnerContent(InformationContext.Current.Owner, portfolio.ID); portfolio.StockCompanies = new StockCompanyCollection(); var collection = PortfolioCollection.RetrieveFromOwnerContent(InformationContext.Current.Owner, "default"); collection.CollectionContent.Add(portfolio); collection.StoreInformationMasterFirst(InformationContext.Current.Owner, true); return(portfolio); } return(Portfolio.RetrieveFromOwnerContent(InformationContext.Current.Owner, id)); }