Exemplo n.º 1
0
        /// <summary>
        /// Change Status Display
        /// </summary>
        /// <param name="pId"></param>
        /// <param name="visibled"></param>
        /// <returns></returns>
        public JsonResult ChageVisibled(string pId, string visibled)
        {
            if (string.IsNullOrEmpty(pId) || string.IsNullOrEmpty(visibled))
            {
                return(Json(new { status = false, message = "Input is wrong" }, JsonRequestBehavior.AllowGet));
            }
            int productId = 0, productVisibled = 0;

            int.TryParse(pId, out productId); int.TryParse(visibled, out productVisibled);
            if (productId <= 0)
            {
                return(Json(new { status = false, message = "Not found." }, JsonRequestBehavior.AllowGet));
            }
            ProductDAL db = new ProductDAL();

            if (db.ChangeVisibled(productId, productVisibled) == 1)
            {
                return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
        }