public object Get(GetCategory request)
        {
            Category result = this.context.Categories.Find(request.CategoryID);
            if (result == null)
            {
                throw HttpError.NotFound(string.Format("Unable to find category with id {0}.", request.CategoryID));
            }

            return new GetCategoryResponse
            {
                Result = new CategoryDto
                {
                    Id = result.Id,
                    Name = result.Name,
                    Description = result.Description
                }
            };
        }
Exemple #2
0
        public object Get(GetCategory request)
        {
            Category result = this.context.Categories.Find(request.CategoryID);

            if (result == null)
            {
                throw HttpError.NotFound(string.Format("Unable to find category with id {0}.", request.CategoryID));
            }

            return(new GetCategoryResponse
            {
                Result = new CategoryDto
                {
                    Id = result.Id,
                    Name = result.Name,
                    Description = result.Description
                }
            });
        }