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