public IActionResult Add(Model.Blog m) { Model.Category ca = cadal.GetModelByNumber(m.CategoryNum); if (ca != null) { m.CategoryName = ca.CategoryName; } if (m.Id == 0) { //新增 dal.Insert(m); } else { //修改 dal.Update(m); } return(Redirect("/Admin/Blog/Index")); }