Override ValidateRequest method from saveHandler in Repository class.

 private class MySaveHandler : SaveRequestHandler<MyRow, SaveRequest<MyRow>, SaveResponse>
        {
            protected override void AfterSave()
            {
                base.AfterSave();

                if (Request.Localizations != null)
                    foreach (var pair in Request.Localizations)
                    {
                        pair.Value.ProductID = Row.ProductID.Value;
                        new LocalizationRowHandler<MyRow>().Update<Entities.ProductLangRow>(this.UnitOfWork, pair.Value, Convert.ToInt32(pair.Key));
                    }
            }

            protected override void ValidateRequest()
            {
                base.ValidateRequest();

                if (IsUpdate || IsCreate)
                {
                    Row.ProductName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Row.ProductName);

                    Row.ProductName = Row.ProductName.ToTitleCase();
                }
            }

        }

Prepare String Extention method for Title case in Common Helper class.

namespace Serene.Modules.Common.Helpers
{
    public static class StringUtils
    {
        public static string ToTitleCase(this string value)
        {
            return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value);
        }
    }
}

results matching ""

    No results matching ""