public ProductionCompany AddProductionCompany(String pcName, int pcId, String logoPath, String originCountry) { ProductionCompany pc = new ProductionCompany(pcName, pcId, logoPath, originCountry); Boolean result = AddProductionCompany(pc); return(pc); }
public Boolean AddProductionCompany(ProductionCompany pc) { Boolean result = ProductionCompanies.Add(pc); if (!result) { ProductionCompanies.Remove(pc); //Force Replace result = ProductionCompanies.Add(pc); } return(result); }
/// <summary> /// Get all Production Companies for a given MovieID /// </summary> /// <param name="movieId"></param> /// <returns></returns> public HashSet <ProductionCompany> GetProductionCompanies(int movieId) { HashSet <ProductionCompany> retVal = new HashSet <ProductionCompany>(); var map = MovieProductionCompanyMap.Where(o => o.MovieId == movieId); foreach (var item in map) { ProductionCompany pc = ProductionCompanies.FirstOrDefault(o => o.Id == item.ProductionCompanyId); if (pc != null) { retVal.Add(pc); } } return(retVal); }