Esempio n. 1
0
        public CategoryInput getModel(IRepository repo)
        {
            var model = new CategoryInput();

            Mapper.CreateMap <CategoryInputView, CategoryInput>();
            Mapper.Map <CategoryInputView, CategoryInput>(this, model);

            model.category = repo.getCategory(this.categoryId);

            return(model);
        }
        public CategoryInput getModel(IRepository repo)
        {
            var model = new CategoryInput();

            Mapper.CreateMap<CategoryInputView, CategoryInput>();
            Mapper.Map<CategoryInputView, CategoryInput>(this, model);

            model.category = repo.getCategory(this.categoryId);

            return model;
        }
        public Category getModel(IRepository repo)
        {
            var model = new Category()
            {
                description = this.description,
                id          = this.id,
                name        = this.name,
                salary      = this.salary,
                parent      = this.parentId == null ? null : repo.getCategory((int)this.parentId),
                order       = this.order,
                url         = this.url
            };

            return(model);
        }
        public HttpResponseMessage Get(int id)
        {
            var model = repo.getCategory(id);

            if (model == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            else
            {
                var view = new CategoryView(model);
                return(Request.CreateResponse(HttpStatusCode.OK, view));
            }
        }
        public Category getModel(IRepository repo)
        {
            var model = new Category()
            {
                description = this.description,
                id = this.id,
                name = this.name,
                salary = this.salary,
                parent = this.parentId == null ? null : repo.getCategory((int)this.parentId),
                order = this.order,
                url = this.url
            };

            return model;
        }