/// <summary> /// Deletes the specified package. /// </summary> /// <param name="package">The package.</param> /// <param name="updateHistorical">if set to <c>true</c> [update historical].</param> /// <returns></returns> public Boolean Delete(ref BLModel.Package package, bool updateHistorical = true) { DLModel.Package existingPkg = new DLModel.Package(); if (package.TitleIds.ToList().Any()) { existingPkg = packageQuery.GetBy(package.TitleIds.ToList(), package.DestinationCode, package.Type); } if (package.ContentIds.ToList().Any()) { existingPkg = packageQuery.GetBy(package.ContentIds.ToList(), package.DestinationCode, package.Type); } if (!string.IsNullOrEmpty(package.AiringId)) { existingPkg = packageQuery.GetBy(package.AiringId, package.DestinationCode, package.Type); } var user = cntx.GetUser(); if (existingPkg != null) { package = existingPkg.ToBusinessModel <DLModel.Package, BLModel.Package>(); existingPkg.ModifiedBy = user.UserName; existingPkg.ModifiedDateTime = DateTime.UtcNow; packagePersist.Delete(existingPkg, user.UserName, updateHistorical); return(true); } return(false); }
/// <summary> /// Deletes the package mapped to airing. /// </summary> /// <param name="airingId">The package.</param> /// <param name="updateHistorical">if set to <c>true</c> [update historical].</param> /// <returns></returns> public bool DeleteAiringMappedPackages(string airingId, bool updateHistorical = true) { DLPackageModel.Package existingPkg = new DLPackageModel.Package(); if (!string.IsNullOrEmpty(airingId)) { existingPkg = packageQueryHelper.GetBy(airingId, "", ""); } if (existingPkg != null) { var username = cntx.GetUser().Name; existingPkg.ModifiedBy = username; packagePersist.DeletePackagebyAiringId(airingId, username, updateHistorical); return(true); } return(false); }