Exemplo n.º 1
0
        // GET: Product
        public ActionResult Index()
        {
            SedesolService.SedesolServiceClient client = new SedesolService.SedesolServiceClient();
            List <ProductDTO> model = new List <ProductDTO>();

            model = client.GetProductAll();
            client.Close();
            return(View(model));
        }
Exemplo n.º 2
0
        public JsonResult SaveProduct(ProductDTO productDTO)
        {
            productDTO.Price      = 0;
            productDTO.CreateDate = DateTime.Now;
            productDTO.EditDate   = DateTime.Now;
            productDTO.CreateUser = ((UserDTO)Session["userData"]).Username;
            productDTO.EditUser   = ((UserDTO)Session["userData"]).Username;

            SedesolService.SedesolServiceClient client = new SedesolService.SedesolServiceClient();

            productDTO = client.SaveProduct(productDTO);
            List <ProductDTO> listProduct = new List <ProductDTO>();

            if (productDTO.Message == "SUCCESS")
            {
                listProduct = client.GetProductAll();
            }
            client.Close();

            string viewContent = ConvertViewToString("ProductList", listProduct);

            return(Json(new { message = productDTO.Message, PartialView = viewContent }));
        }