public IActionResult InsertFavorite([FromBody] Favorite favorite) { string msg; FavoriteDAO dao = new FavoriteDAO(_context); if (dao.Insert(favorite)) { msg = "Add accessory to favorite list successfully"; } else { msg = "Add accessory to favorite list failed"; } return(new JsonResult(msg)); }
/// <summary> /// 向数据库中添加一条记录 /// </summary> /// <param name="model">要添加的实体</param> /// <returns>是否成功</returns> public bool Insert(Favorite model) { return(_dao.Insert(model)); }