Esempio n. 1
0
        public ActionResult <ResponseJson> Post([FromBody] Models.cm_role model)
        {
            ResponseJson json = new ResponseJson();

            //写不进报错
            if (!service.Insert(model))
            {
                json.Code = "500";
                json.Msg  = $"增加[角色:{model.name}]失败!";
            }
            return(json);
        }
Esempio n. 2
0
        public ActionResult <ResponseJson> Put(long id, [FromBody] Models.cm_role model)
        {
            ResponseJson json = new ResponseJson();
            bool         flag = false;

            if (service.Exists(id))
            {
                model.id = id;
                flag     = service.Update(model);
            }
            if (!flag)
            {
                json.Code = "500";
                json.Msg  = "修改失败!";
            }
            return(json);
        }