public async Task <DTOtransactiontype> Posttransactiontype(DTOtransactiontype newDTO)
        {
            transactiontype newProd = EntityMapper.updateEntity(null, newDTO);

            db.transactiontypes.Add(newProd);
            await db.SaveChangesAsync();

            return(newDTO);
        }
        public async Task <IHttpActionResult> Puttransactiontype(int ID, DTOtransactiontype editedDTO)
        {
            transactiontype toUpdate = db.transactiontypes.Find(ID);

            toUpdate = EntityMapper.updateEntity(toUpdate, editedDTO);
            db.Entry(toUpdate).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 3
0
        public static transactiontype updateEntity(transactiontype entityObjct, DTOtransactiontype dto)
        {
            if (entityObjct == null)
            {
                entityObjct = new transactiontype();
            }

            entityObjct.TransactionType_ID         = dto.TransactionType_ID;
            entityObjct.transactionTypeDescription = dto.transactionTypeDescription;

            return(entityObjct);
        }
Esempio n. 4
0
        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();
        }