public IActionResult Index(BianMinModel m) { if (string.IsNullOrWhiteSpace(m.HeadImg)) { m.HeadImg = "https://sqbiamin.cn/base.jpg"; } if (string.IsNullOrWhiteSpace(m.NickName)) { m.NickName = "宿迁便民"; } m.CreateDate = DateTime.Now; if (m.Id > 0)//修改 { if (_bianMinService.UpdateBianMinModel(m)) { return(Json(new { code = 0, msg = "修改成功" })); } else { return(Json(new { code = 1, msg = "修改失败" })); } } else//新增 { if (_bianMinService.AddBianMinModel(m)) { return(Json(new { code = 0, msg = "添加成功" })); } else { return(Json(new { code = 1, msg = "添加失败" })); } } }
public bool AddMessage(BianMinModel model) { if (string.IsNullOrWhiteSpace(model.HeadImg)) { model.HeadImg = "https://sqbiamin.cn/base.jpg"; } if (string.IsNullOrWhiteSpace(model.NickName)) { model.NickName = "宿迁便民"; } model.CreateDate = DateTime.Now; return(_bianMinService.AddBianMinModel(model)); }
public bool AddMessage(BianMinModel model) { model.CreateDate = DateTime.Now; return(_bianMinService.AddBianMinModel(model)); }