/*删除商品的评论信息*/ public void DeleteReview(Review review) { try { mRepository.DeleteReview(review,true); } catch (Exception ex) { throw ex; } }
public void InsertReview(Review review) { review.createAt = DateTime.Now; try { mRepository.InsertReview(review,true); } catch (Exception ex) { throw ex; } }
public bool AddReview(Review review) { ReviewBL bl = new ReviewBL(); try { bl.InsertReview(review); return true; } catch { return false; } }
public void InsertReview(Review review, bool isImmediateSave) { try { mContext.Reviews.AddObject(review); if (isImmediateSave) { mContext.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void UpdateReview(Review review, Review origReview, bool isImmediateSave) { try { mContext.Reviews.Attach(origReview); mContext.Reviews.ApplyCurrentValues(review); if (isImmediateSave) { mContext.SaveChanges(); } } catch (Exception ex) { // TODO: Add exception handling code here. throw ex; } }
public void DeleteReview(Review review, bool isImmediateSave) { try { mContext.Reviews.Attach(review); mContext.Reviews.DeleteObject(review); if(isImmediateSave) { mContext.SaveChanges(); } } catch (Exception ex) { // TODO: Add exception handling code here. throw ex; } }
/*用户更新商品的评论信息*/ public void UpdateReview(Review review, Review origReview) { try { mRepository.UpdateReview(review, origReview,true); } catch (Exception ex) { throw ex; } }
public bool RemoveReview(Review review) { ReviewBL bl = new ReviewBL(); try { bl.DeleteReview(review); return true; } catch { return false; } }
/// <summary> /// 用于向 Reviews EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToReviews(Review review) { base.AddObject("Reviews", review); }
/// <summary> /// 创建新的 Review 对象。 /// </summary> /// <param name="reviewID">reviewID 属性的初始值。</param> /// <param name="userID">userID 属性的初始值。</param> /// <param name="productID">productID 属性的初始值。</param> /// <param name="comment">comment 属性的初始值。</param> /// <param name="rating">rating 属性的初始值。</param> /// <param name="createAt">createAt 属性的初始值。</param> public static Review CreateReview(global::System.Int32 reviewID, global::System.Int32 userID, global::System.Int32 productID, global::System.String comment, global::System.Int32 rating, global::System.DateTime createAt) { Review review = new Review(); review.reviewID = reviewID; review.userID = userID; review.productID = productID; review.comment = comment; review.rating = rating; review.createAt = createAt; return review; }