public MessageModel <string> Post([FromBody] MngAdmin model) { MngAdminService.AddEntity(model); return(new MessageModel <string> { success = true, msg = "添加成功" }); }
public MessageModel <MngAdmin> Get(int id) { MngAdmin model = MngAdminService.FindSingle(f => f.Id == id); bool flag = model != null || model.Id > 0; return(new MessageModel <MngAdmin> { success = flag, msg = flag ? "查询成功" : $"没有id为{id}的数据", model = flag ? model : new MngAdmin() }); }