public void createNew(int bankID, decimal amount, string description, int ccCardTypeID) { using (var ctx = new AccountingLib.Models.AccContexts()) { var existingFee = ctx.ccFee .Where(x => x.ccCardTypeID == ccCardTypeID && x.bankID == bankID).SingleOrDefault(); if (existingFee != null) { ctx.ccFee.DeleteObject(existingFee); ctx.SaveChanges(); } var _ccFee = new AccountingLib.Models.ccFee() { bankID = (int)bankID, ccCardTypeID = (int)ccCardTypeID, amount = (decimal)amount, description = description }; ctx.ccFee.AddObject(_ccFee); ctx.SaveChanges(); /*Reload Object*/ this.loadFeeByID(_ccFee.ID); } }
/// <summary> /// Create a new ccFee object. /// </summary> /// <param name="id">Initial value of the ID property.</param> public static ccFee CreateccFee(global::System.Int32 id) { ccFee ccFee = new ccFee(); ccFee.ID = id; return ccFee; }
/// <summary> /// Deprecated Method for adding a new object to the ccFee EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToccFee(ccFee ccFee) { base.AddObject("ccFee", ccFee); }