Esempio n. 1
0
        public static QuerySingleObjectResult <T> FindOneBy <T>(QueryInput input)
            where T : Entity
        {
            Log.Write("FindOneBy (" + typeof(T).Name + ")", LogSeverity.Information);
            var result = new QuerySingleObjectResult <T>(FindBy <T>(input));

            return(result);
        }
Esempio n. 2
0
        private static QuerySingleObjectResult <T> CreateSingleObjectResult <T>(HttpResponseMessage response, T obj, int?id)
            where T : Entity
        {
            var output = new QuerySingleObjectResult <T>
            {
                Success    = obj != null,
                StatusCode = response.StatusCode,
                //ErrorMessage = response.ErrorMessage,
                Object = obj
            };

            if (!output.Success)
            {
                output.ErrorMessage = "Penneo: Could not find the requested " + typeof(T).Name;
                if (id.HasValue)
                {
                    output.ErrorMessage += " (id = " + id + ")";
                }
            }
            return(output);
        }