Ejemplo n.º 1
0
        /// <summary>
        /// Sample validation function (registered in Startup)
        /// </summary>
        public static Task InitializeCustomer(Daton daton)
        {
            var cust = daton as Customer;

            cust.Notes = "Leads:\r\nComplaints:";
            return(Task.CompletedTask);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sample validation function (registered in Startup)
        /// </summary>
        public static Task <IEnumerable <string> > ValidateCustomer(Daton daton, ViewonKey _, IUser user)
        {
            var cust   = daton as Customer;
            var errors = new List <string>();

            //silly rule to demonstrate custom validation:
            if (cust.Company.StartsWith("The", StringComparison.InvariantCultureIgnoreCase))
            {
                errors.Add("Companies cannot start with 'the' ");
            }
            //note that you can use multi language strings here by checking user.LangCode

            //This longer return expression is used when we are not doing async validation. For async validation,
            //make the validation method async and return errors directly.
            return(Task.FromResult(errors as IEnumerable <string>)); //sync return
            //return errors; //async return
        }
Ejemplo n.º 3
0
 public override void Recompute(Daton daton)
 {
     AngryMethod = $"Arrg, I'll pay with {Method}";
 }
Ejemplo n.º 4
0
 public override void Recompute(Daton daton)
 {
     FormattedMoney = $"{Money} gold pieces";
 }