Beispiel #1
0
 /// <summary>
 /// Add error to custom ModelErrorsSet
 /// </summary>
 /// <param name="list">List to add</param>
 /// <param name="condition">Condition to check</param>
 /// <param name="field">Name of the field</param>
 /// <param name="message">Message of the error in en</param>
 /// <param name="localizedMessage">Message of the error in ru</param>
 /// <param name="type">Type of the error</param>
 public static ICollection <CustomModelError> AddError(
     this ICollection <CustomModelError> list,
     Func <bool> condition,
     string field,
     string message,
     string localizedMessage,
     TypeCriticalException type = TypeCriticalException.TRANSACTION) =>
 condition() ? list.AddError(field, message, localizedMessage, type) : list;
Beispiel #2
0
        /// <summary>
        /// Add error to custom ModelErrorsSet
        /// </summary>
        /// <param name="list">List to add</param>
        /// <param name="field">Name of the field</param>
        /// <param name="message">Message of the error in en</param>
        /// <param name="localizedMessage">Message of the error in ru</param>
        /// <param name="type">Type of the error</param>
        public static ICollection <CustomModelError> AddError(
            this ICollection <CustomModelError> list,
            string field,
            string message,
            string localizedMessage,
            TypeCriticalException type = TypeCriticalException.TRANSACTION)
        {
            list.Add(new CustomModelError
            {
                FieldName        = field,
                Message          = message,
                LocalizedMessage = localizedMessage ?? message,
                Type             = type
            });

            return(list);
        }
 /// <inheritdoc />
 public CriticalException(string message, TypeCriticalException type = TypeCriticalException.USER,
                          HttpStatusCode statusCode = HttpStatusCode.InternalServerError) : base(message)
 {
     StatusCode            = statusCode;
     TypeCriticalException = type;
 }
 public CriticalException(string message, TypeCriticalException type = TypeCriticalException.USER) :
     base(message)
 {
     TypeCriticalException = type;
 }