public bool Add([FromBody] Menu menu) { try { return(_menuDao.Add(menu)); } catch (Exception ex) { nlog.Error(ex, "添加菜单失败!", menu.ToJSON()); return(false); } }
public void Add() { var model = new Menu() { Name = "首页", ParentId = 0, SortNum = 1, Url = "/home/index" }; var result = MenuDao.Add(model); Assert.AreEqual(1, result); }