public IHttpActionResult Post(Product product)
        {
            IHttpActionResult ret = null;
            PTCViewModel      vm  = new PTCViewModel();

            if (product != null)
            {
                vm.Entity   = product;
                vm.PageMode = PDSAPageModeEnum.Add;
                vm.Save();
                if (vm.IsValid)
                {
                    ret = Created <Product>(
                        Request.RequestUri +
                        vm.Entity.ProductId.ToString(),
                        vm.Entity);
                }
                else
                {
                    if (vm.Messages.Count > 0)
                    {
                        ret = BadRequest(ConvertToModelState(vm.Messages));
                    }
                    else
                    {
                        ret = BadRequest(vm.Message);
                    }
                }
            }
            else
            {
                ret = NotFound();
            }
            return(ret);
        }
        public IHttpActionResult Put(int id, Product product)
        {
            IHttpActionResult ret = null;
            PTCViewModel      vm  = new PTCViewModel();

            if (product != null)
            {
                vm.Entity   = product;
                vm.PageMode = PDSAPageModeEnum.Edit;
                vm.Save();
                if (vm.IsValid)
                {
                    ret = Ok(vm.Entity);
                }
                else
                {
                    if (vm.Messages.Count > 0)
                    {
                        ret = BadRequest(ConvertToModelState(vm.Messages));
                    }
                    else if (vm.LastException != null)
                    {
                        ret = BadRequest(vm.Message);
                    }
                }
            }
            else
            {
                ret = NotFound();
            }
            return(ret);
        }