public async Task <DTOvouchertransaction> Postvouchertransaction(DTOvouchertransaction newDTO) { vouchertransaction newProd = EntityMapper.updateEntity(null, newDTO); db.vouchertransactions.Add(newProd); await db.SaveChangesAsync(); return(newDTO); }
public async Task <IHttpActionResult> Putvouchertransaction(int ID, DTOvouchertransaction editedDTO) { vouchertransaction toUpdate = db.vouchertransactions.Find(ID); toUpdate = EntityMapper.updateEntity(toUpdate, editedDTO); db.Entry(toUpdate).State = EntityState.Modified; await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
private void addVoucherTransactionLog(int voucherID, int voucherSentTo, int SenderID, int ReceiverID, int transType, decimal amount, string description, DateTime date) { vouchertransaction vouchTrans = new vouchertransaction(); vouchTrans.Voucher_ID = voucherID; vouchTrans.VoucherSentTo = voucherSentTo; vouchTrans.Sender_ID = SenderID; vouchTrans.Receiver_ID = ReceiverID; vouchTrans.TransactionType_ID = transType; vouchTrans.transactionAmount = amount; vouchTrans.transactionDescription = description; vouchTrans.transactionDate = date; db.vouchertransactions.Add(vouchTrans); db.SaveChanges(); }
public static vouchertransaction updateEntity(vouchertransaction entityObjct, DTOvouchertransaction dto) { if (entityObjct == null) { entityObjct = new vouchertransaction(); } entityObjct.Voucher_ID = dto.Voucher_ID; entityObjct.VoucherSentTo = dto.VoucherSentTo; entityObjct.Sender_ID = dto.Sender_ID; entityObjct.Receiver_ID = dto.Receiver_ID; entityObjct.TransactionType_ID = dto.TransactionType_ID; entityObjct.transactionAmount = dto.transactionAmount; entityObjct.transactionDescription = dto.transactionDescription; entityObjct.transactionDate = dto.transactionDate; return(entityObjct); }
private void addVoucherTransaction(int newVoucherID, int voucherID, int receiverID, int senderID, decimal Amount, int transactionTypeID, DateTime datum) { vouchertransaction newTransaction = new vouchertransaction(); newTransaction.VoucherSentTo = newVoucherID; newTransaction.Voucher_ID = voucherID; newTransaction.Receiver_ID = receiverID; newTransaction.Sender_ID = senderID; newTransaction.transactionAmount = Amount; newTransaction.TransactionType_ID = transactionTypeID; DateTime now = datum; now.ToString("yyyy-MM-dd H:mm:ss"); newTransaction.transactionDate = now; //newTransaction.transactionDate = DateTime.Now; newTransaction.transactionDescription = "Reseller purchase of bulk voucher"; db.vouchertransactions.Add(newTransaction); db.SaveChanges(); }
private void addVoucherTransaction(int newVoucherID, int voucherID, int receiverID, int senderID, decimal Amount, int transactionTypeID) { vouchertransaction newTransaction = new vouchertransaction(); newTransaction.VoucherSentTo = newVoucherID; newTransaction.Voucher_ID = voucherID; newTransaction.Receiver_ID = receiverID; newTransaction.Sender_ID = senderID; newTransaction.transactionAmount = Amount; newTransaction.TransactionType_ID = transactionTypeID; DateTime now = DateTime.Now; now.ToString("yyyy-MM-dd H:mm:ss"); newTransaction.transactionDate = now; transactiontype transactionTypeString = (from list in db.transactiontypes where list.TransactionType_ID == transactionTypeID select list).Single(); newTransaction.transactionDescription = transactionTypeString.transactionTypeDescription; db.vouchertransactions.Add(newTransaction); db.SaveChanges(); }