コード例 #1
0
        public async ValueTask <RequestResult <Order> > AddOrder(Order dataModel)
        {
            var result = new RequestResult <Order>();

            try
            {
                _orderStorege.TransactionStart();
                string  country;
                decimal currency = 1;

                switch (dataModel.City.Id)
                {
                case (int)CountryTypeEnam.Belarus:
                    country  = "UAH";
                    currency = await CurCurrency.GetCurrentCurrency(country);

                    break;

                case (int)CountryTypeEnam.Ukraine:
                    country  = "BYN";
                    currency = await CurCurrency.GetCurrentCurrency(country);

                    break;
                }
                result.RequestData = await _orderStorege.OrderAdd(dataModel, currency);

                _orderStorege.TransactionCommit();
                result.IsOkay = true;
            }
            catch (Exception ex)
            {
                _orderStorege.TransactioRollBack();
                result.ExMessage = ex.Message;
            }
            return(result);
        }