Exemplo n.º 1
0
        public JsonResult delete(string id)
        {
            int      ret = 0;
            MENU_BUS bus = new MENU_BUS();

            MENU_OBJ obj = bus.GetMenuByCode(id);

            if (obj == null)
            {
                ret = -1;
            }
            if (ret >= 0)
            {
                ret = bus.Delete(obj);
            }
            bus.CloseConnection();
            return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Cập nhật một bản ghi được gửi lên từ phía client
        /// </summary>
        public JsonResult create(MENU_OBJ obj)
        {
            MENU_BUS bus  = new MENU_BUS();
            int      ret  = 0;
            var      data = bus.GetMenuByCode(obj.MenuId);

            if (data == null)
            {
                ret    = 0;
                obj.ID = Guid.NewGuid().ToString();
                ret    = bus.Insert(obj);
            }
            else
            {
                ret = -1;
            }
            bus.CloseConnection();

            //some thing like that
            return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Cập nhật một bản ghi được gửi lên từ phía client
        /// </summary>
        public JsonResult update(MENU_OBJ obj)
        {
            MENU_BUS bus  = new MENU_BUS();
            int      ret  = 0;
            var      data = bus.GetMenuByCode(obj.MenuId);

            if (data != null)
            {
                ret             = 0;
                obj.IUPDATEDTAE = DateTime.Now;
                ret             = bus.Update(obj);
            }
            else
            {
                ret = -1;
            }
            bus.CloseConnection();

            //some thing like that
            return(Json(new { sussess = ret }, JsonRequestBehavior.AllowGet));
        }