public IActionResult Add(Model.Blog m) { m.CreateDate = DateTime.Now; if (m.CaName == null) { m.CaName = "默认"; } Model.Category ca = cadal.GetModelByBh(m.CaBh); if (ca != null) { m.CaName = ca.CaName; } if (m.Id == 0) { //新增 dal.Insert(m); } else { //修改 dal.Update(m); } return(Redirect("/Adnn1n/Blog/Index")); }
public IActionResult Add(Model.Blog m) { Model.Category ca = cadal.GetModelByBh(m.CaBh); if (ca != null) { m.CaName = ca.CaName; } if (m.Id == 0) { dal.Insert(m); } else { m.updatetime = DateTime.Now; dal.Update(m); } return(Redirect("/Admin/Blog/Index")); }
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")); }
public IActionResult Add(Model.Blog m) { Model.Category ca = cadal.GetModelByBh(m.cabh); if (ca != null) { m.caname = ca.CaName; } if (m.id == 0) { //新增 m.createdate = DateTime.Now; dal.Add(m); } else { //修改 m.updatetime = DateTime.Now; dal.Update(m); } return(Redirect("/Adnn1n/Blog/Index")); }
public IActionResult Add(Model.Blog blog) { blog.CreateDate = DateTime.Now; if (blog.CateNo == "0") { //新分类,先增加 string cateNo = catedal.GetCateNo("0", 2); catedal.Insert(new Model.Category() { CateName = blog.CateName, CateNo = cateNo, CreateDate = DateTime.Now, ParentCate = "0", Remark = "" }); blog.CateNo = cateNo; } if (blog.Id == 0) { blogdal.Insert(blog); return(Json(new { status = "y", info = "博客新增成功!" })); } else { blogdal.Update(blog); return(Json(new { status = "y", info = "博客编辑成功!" })); } }