private string GetTranslatedUrl(string sourceUrl, BLPathModel.PathTranslation pt, Airing airing) { var result = sourceUrl.Replace(pt.Source.BaseUrl, pt.Target.BaseUrl); if (!string.IsNullOrEmpty(pt.Source.Brand) && pt.Source.Brand.Equals(airing.Network, StringComparison.OrdinalIgnoreCase)) { return(result); } else if (string.IsNullOrEmpty(pt.Source.Brand)) { return(result); } else { return(string.Empty); } }
/// <summary> /// Save the given path translation model. If it already exist, /// update it; else, create a new one. /// </summary> /// <param name="model">Path translation model</param> public BLModel.PathTranslation Save(BLModel.PathTranslation model) { // If the model Id is empty then the assumption is that // this is a new model. Hence provide create user and timestamp if (string.IsNullOrEmpty(model.Id)) { model.CreatedBy = cntx.GetHttpIdentity().Name; model.CreatedDateTime = DateTime.UtcNow; } // For auditing model.ModifiedBy = cntx.GetHttpIdentity().Name; model.ModifiedDateTime = DateTime.UtcNow; return (translationCommandHelper.Save(model.ToDataModel <BLModel.PathTranslation, DLModel.PathTranslation>()) .ToBusinessModel <DLModel.PathTranslation, BLModel.PathTranslation>()); }