public ActionResult Add(FavoriteInfo fi) { if (fi != null && checkModel(fi)) { _IFavoriteInfoServce.Add(fi); return Json(_IFavoriteInfoServce.Commit()); } return Json(0); }
public ActionResult Edit(FavoriteInfo fi) { FavoriteInfo old = _IFavoriteInfoServce.QueryById(fi.FavoriteID); if (fi != null && checkModel(fi)) { old.JumpUrl = fi.JumpUrl; old.SimplifiedDisplay = fi.SimplifiedDisplay; old.SimplifiedPrompt = fi.SimplifiedPrompt; old.TraditionalDisplay = fi.TraditionalDisplay; old.TraditionalPrompt = fi.TraditionalPrompt; _IFavoriteInfoServce.Update(old); return Json(_IFavoriteInfoServce.Commit()); } return Json(0); }
private bool checkModel(FavoriteInfo fi) { if (!string.IsNullOrWhiteSpace(fi.SimplifiedDisplay) && !string.IsNullOrWhiteSpace(fi.SimplifiedPrompt) && !string.IsNullOrWhiteSpace(fi.TraditionalDisplay) && !string.IsNullOrWhiteSpace(fi.TraditionalPrompt) && !string.IsNullOrWhiteSpace(fi.JumpUrl)) { return true; } return false; }