Ejemplo n.º 1
0
        /// <summary>
        /// Returns a DomainResponse class with data Serialize on JSON
        /// </summary>
        /// <typeparam name="T">The desired type LightViewModel</typeparam>
        /// <returns>Instance of the specified DomainResponse</returns>
        protected DomainResponse Response <T>(T data)
        {
            DomainResponse response = new DomainResponse();

            response.Critics         = (_criticHandler != null) ? _criticHandler.Critics.ToJsonCamelCase() : null;
            response.ModelData       = data;
            response.NotFoundMessage = HasNotFoundError;
            return(response);
        }
        /// <summary>
        /// Returns a DomainResponse class with data Serialize on JSON
        /// </summary>
        /// <typeparam name="T">The desired type LightViewModel</typeparam>
        /// <returns>Instance of the specified DomainResponse</returns>
        protected DomainResponse Response <T>(T data)
        {
            DomainResponse response = new DomainResponse();

            response.Critics              = CritictHandler?.Critics?.ToJsonCamelCase();
            response.ModelData            = data;
            response.NotFoundMessage      = HasNotFoundError;
            response.BadRequestMessage    = HasBadRequestError;
            response.GenericReturnMessage = HasNotGenericReturn;
            response.StatusCode           = StatusCode;
            response.OperationId          = System.Diagnostics.Activity.Current?.RootId;
            return(response);
        }