/*删除用户反馈信息的业务逻辑*/ public void DeleteSuggestion(Suggestion suggestion) { try { mRepository.DeleteSuggestion(suggestion, true); } catch(Exception ex) { throw ex; } }
/*用户给超市发布反馈信息的业务逻辑*/ public void InsertSuggestion(Suggestion suggestion) { suggestion.date = DateTime.Now; try { mRepository.InsertSuggestion(suggestion, true); } catch (Exception ex) { throw ex; } }
public bool AddSuggestion(Suggestion suggestion) { SuggestionBL bl = new SuggestionBL(); try { bl.InsertSuggestion(suggestion); return true; } catch { return false; } }
public void InsertSuggestion(Suggestion suggestion, bool isImmediateSave) { try { mContext.Suggestions.AddObject(suggestion); if (isImmediateSave) { mContext.SaveChanges(); } } catch (Exception ex) { // TODO: Add exception handling code here. throw ex; } }
public void UpdateSuggestion(Suggestion suggestion, Suggestion origSuggestion, bool isImmediateSave) { try { mContext.Suggestions.Attach(origSuggestion); mContext.Suggestions.ApplyCurrentValues(suggestion); if (isImmediateSave) { mContext.SaveChanges(); } } catch (Exception ex) { // TODO: Add exception handling code here. throw ex; } }
/// <summary> /// 用于向 Suggestions EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToSuggestions(Suggestion suggestion) { base.AddObject("Suggestions", suggestion); }
/// <summary> /// 创建新的 Suggestion 对象。 /// </summary> /// <param name="id">id 属性的初始值。</param> /// <param name="description">description 属性的初始值。</param> /// <param name="date">date 属性的初始值。</param> public static Suggestion CreateSuggestion(global::System.Int32 id, global::System.String description, global::System.DateTime date) { Suggestion suggestion = new Suggestion(); suggestion.id = id; suggestion.description = description; suggestion.date = date; return suggestion; }