public CategoryViewModel(ServiceReference.Category categoryClient)
 {
     Id          = categoryClient.Id;
     Name        = categoryClient.Name;
     Description = categoryClient.Description;
     Level       = categoryClient.Level;
     ParentId    = categoryClient.ParentId;
     Enabled     = categoryClient.Enabled;
 }
        public ActionResult Edit(CategoryViewModel category)
        {
            var app = new ServiceReference.ContractClient();

            var model = new ServiceReference.Category
            {
                Id          = category.Id,
                Name        = category.Name,
                Description = category.Description,
                Level       = category.Level,
                ParentId    = category.ParentId,
                Enabled     = category.Enabled
            };

            if (category.ParentId == null)
            {
                category.ParentId = 0;
            }
            app.UpdateCategory(model);

            return(RedirectToAction("GetAll"));
        }