public HttpResponseMessage Update(HttpRequestMessage request, TypeProductViewModel vm)
        {
            string message = "";
            var    srv     = IoC.Resolve <ITypeProductCategoryService>();
            var    model   = vm.UpdateModel(srv.GetbyKey(vm.Id));

            if (srv.Update(model, out message))
            {
                return(request.CreateResponse(HttpStatusCode.OK, srv.GetAll()));
            }
            return(request.CreateResponse(HttpStatusCode.BadRequest, message));
        }
        public HttpResponseMessage GetbyKey(HttpRequestMessage request, int id)
        {
            var s      = IoC.Resolve <ITypeProductCategoryService>();
            var entity = s.GetbyKey(id);
            var rs     = new TypeProductViewModel
            {
                Id     = entity.Id,
                Name   = entity.Name,
                Status = entity.Status
            };

            return(request.CreateResponse(HttpStatusCode.OK, rs));
        }