public Transaction_Rs Execute(Transaction_Rq rq)
        {
            Transaction_Rs rs = new Transaction_Rs();

            try
            {
                Transaction transaction = _dbContext.Transactions.Where(c => c.Id == rq.Id).FirstOrDefault();
                if (transaction != null)
                {
                    transaction.Id            = rq.Id;
                    transaction.Time          = rq.Time;
                    transaction.Type          = rq.Type;
                    transaction.AmountValue   = rq.AmountValue;
                    transaction.ContactWho    = rq.ContactWho;
                    transaction.ContactNumber = rq.ContactNumber;
                    transaction.Status        = rq.Status;
                    transaction.Description   = rq.Description;

                    _dbContext.Entry(transaction).State = EntityState.Modified;
                    _dbContext.SaveChanges();

                    rs.ResponseCode = ResponseCode.Success;
                }

                return(rs);
            }
            catch (Exception)
            {
                rs.ResponseCode = ResponseCode.InternalServerError;
                throw;
            }
        }
Beispiel #2
0
        public Contract_Rs Execute(Contract_Rq rq)
        {
            Contract_Rs rs = new Contract_Rs();

            try
            {
                Contract contract = _dbContext.Contracts.Where(c => c.Id == rq.Id).FirstOrDefault();
                if (contract != null)
                {
                    contract.Revenue        = rq.Revenue;
                    contract.PackageName    = rq.PackageName;
                    contract.Note           = rq.Note;
                    contract.BuyDate        = rq.BuyDate;
                    contract.BuyFrom        = rq.BuyFrom;
                    contract.BuyPrice       = rq.BuyPrice;
                    contract.Fee            = rq.Fee;
                    contract.RevenuePercent = rq.RevenuePercent;
                    contract.SellDate       = rq.SellDate;
                    contract.SellPrice      = rq.SellPrice;
                    contract.SellTo         = rq.SellTo;
                    contract.WaitingDate    = rq.WaitingDate;

                    _dbContext.Entry(contract).State = EntityState.Modified;
                    _dbContext.SaveChanges();

                    rs.ResponseCode = ResponseCode.Success;
                }

                return(rs);
            }
            catch (Exception)
            {
                rs.ResponseCode = ResponseCode.InternalServerError;
                throw;
            }
        }