public ExchangeDto GetExchangeDtoFromExchange(Exchange exchange, int userId) { var newExchangeDto = new ExchangeDto() { ExchangeId = exchange.ExchangeId, Shipment = exchange.Shipment, State = exchange.State }; if (exchange.OfferingUserId == userId) { newExchangeDto.OtherUserId = exchange.OtherUserId; newExchangeDto.MyGamesIds = exchange.OfferingUsersGames.Split(',').ToArray(); newExchangeDto.OtherUserGamesIds = exchange.OtherUsersGames.Split(',').ToArray(); newExchangeDto.MyFinalizeTime = exchange.OfferingUserFinalizeTime; newExchangeDto.OtherUserFinalizeTime = exchange.OtherUserFinalizeTime; newExchangeDto.MyContactInfo = exchange.OfferingUserContactInfo ?? string.Empty; newExchangeDto.OtherUserContactInfo = exchange.OtherUserContactInfo ?? string.Empty; } else { newExchangeDto.OtherUserId = exchange.OfferingUserId; newExchangeDto.MyGamesIds = exchange.OtherUsersGames.Split(',').ToArray(); newExchangeDto.OtherUserGamesIds = exchange.OfferingUsersGames.Split(',').ToArray(); newExchangeDto.MyFinalizeTime = exchange.OtherUserFinalizeTime; newExchangeDto.OtherUserFinalizeTime = exchange.OfferingUserFinalizeTime; newExchangeDto.OtherUserContactInfo = exchange.OfferingUserContactInfo ?? string.Empty; newExchangeDto.MyContactInfo = exchange.OtherUserContactInfo ?? string.Empty; } return(newExchangeDto); }
private IReadOnlyCollection <DataGenerationPlan> Plan( IReadOnlyCollection <string> sedols, ExchangeDto dto, DateTime from) { if (!sedols?.Any() ?? true) { return(new DataGenerationPlan[0]); } var result = new List <DataGenerationPlan>(); var i = 1; foreach (var sedol in sedols) { var openTime = from.Add(dto.MarketOpenTime).AddMinutes(i * 60); var intervalInstruction = new IntervalEquityPriceInstruction( sedol, openTime.TimeOfDay, openTime.TimeOfDay.Add(TimeSpan.FromMinutes(45)), TimeSpan.FromMinutes(1), from.Date.Add(openTime.TimeOfDay), from.Date.Add(openTime.TimeOfDay.Add(TimeSpan.FromMinutes(45))), PriceManipulation.Increase, 0.03m); var newPlan = new DataGenerationPlan(sedol, intervalInstruction); result.Add(newPlan); i++; } return(result); }
public static ExchangeDto CopyFromEntity(ExchangeDto dto, ProductExchange product_Exchange) { if (dto == null) { dto = new ExchangeDto(); return(dto); } if (dto.exchange_quantity > 0) { dto.exchange_id = product_Exchange.PrExID; dto.exchange_quantity = product_Exchange.ExchangeQuantity; dto.exchange_price = product_Exchange.ExchangePromoPrice; dto.exchange_promo_price = product_Exchange.ExchangePromoPrice; dto.exchange_with = product_Exchange.ExchangeWith; } else { dto.exchange_id = 0; dto.exchange_quantity = 0; dto.exchange_price = 0; dto.exchange_promo_price = 0; dto.exchange_with = ""; } return(dto); }
public void GetTradingDaysWithinRangeAdjustedToTime_Start_Ok_End_Ok_Can_Find_Mic_Returns_2_Dates_For_Weekend() { var marketTradingHoursManager = this.Build(); var exchangeDto = new ExchangeDto { Code = "XLON", MarketOpenTime = TimeSpan.FromHours(8), MarketCloseTime = TimeSpan.FromHours(16), Holidays = new[] { new DateTime(2018, 01, 02) }, IsOpenOnMonday = true, IsOpenOnTuesday = true, IsOpenOnWednesday = true, IsOpenOnThursday = true, IsOpenOnFriday = true, IsOpenOnSaturday = false, IsOpenOnSunday = false }; A.CallTo(() => this._marketOpenCloseRepository.GetAsync()).Returns(new[] { exchangeDto }); var result = marketTradingHoursManager.GetTradingDaysWithinRangeAdjustedToTime( DateTime.Parse("2019/02/01"), DateTime.Parse("2019/02/04"), "XLON"); Assert.AreEqual(result.Count, 2); }
public void Setup() { this._logger = A.Fake <ILogger <MarketOpenCloseEventService> >(); this._repository = A.Fake <IMarketOpenCloseApiCachingDecorator>(); this._marketOpenClose = new ExchangeDto { Code = "XLON", MarketOpenTime = TimeSpan.FromHours(8), MarketCloseTime = TimeSpan.FromHours(16).Add(TimeSpan.FromMinutes(30)), TimeZone = "UTC", IsOpenOnMonday = true, IsOpenOnTuesday = true, IsOpenOnWednesday = true, IsOpenOnThursday = true, IsOpenOnFriday = true, IsOpenOnSaturday = true, IsOpenOnSunday = true }; IReadOnlyCollection <ExchangeDto> testCollection = new List <ExchangeDto> { this._marketOpenClose }; A.CallTo(() => this._repository.GetAsync()).Returns(Task.FromResult(testCollection)); }
public static async Task <List <ExchangeDto> > GetExchangesFromReponse(HttpResponseMessage response) { var json = await response.Content.ReadAsStringAsync(); var jsonObject = JObject.Parse(json); var results = new List <ExchangeDto>(); foreach (var data in jsonObject["data"].ToList()) { var timeString = data["last_trade_at"].ToString(); DateTime?time = null; if (timeString != "" && timeString != null) { time = DateTime.Parse(timeString); } float.TryParse(data["price_usd"].ToString(), out var priceInUsd); var dto = new ExchangeDto { Id = data["id"].ToString(), Name = data["exchange_name"].ToString(), Slug = data["exchange_slug"].ToString(), AssetSymbol = data["base_asset_symbol"].ToString(), PriceInUsd = priceInUsd, LastTrade = time }; results.Add(dto); } return(results); }
public static void CopyFromEntity(ProductDetailsDto dto, Product product) { dto.product_id = product.ProdID; // product_description dto.product_name = product.ProductName; dto.position = product.Position; dto.product_image = ImagePathService.productImagePath + product.ProductImage; dto.product_image_details = ImagePathService.productImagePath + product.ProductImageDetails; dto.tube_price = product.TubePrice; dto.tube_promo_price = product.TubePromoPrice; dto.refill_price = product.RefillPrice; dto.refill_promo_price = product.RefillPromoPrice; dto.shipping_price = product.ShippingPrice; dto.shipping_promo_price = product.ShippingPromoPrice; if (product.ProductExchanges.Count > 0) { dto.has_exchange = true; dto.exchange = new ExchangeDto[product.ProductExchanges.Count]; var prdExchanges = product.ProductExchanges.ToList(); for (int i = 0; i < product.ProductExchanges.Count; i++) { ExchangeDto exDto = new ExchangeDto(); exDto.exchange_id = prdExchanges[i].PrExID; exDto.exchange_with = prdExchanges[i].ExchangeWith; exDto.exchange_quantity = prdExchanges[i].ExchangeQuantity; exDto.exchange_price = prdExchanges[i].ExchangePrice.Value; exDto.exchange_promo_price = prdExchanges[i].ExchangePromoPrice; dto.exchange[i] = exDto; } } }
public bool FinalizeExchange(ExchangeDto exchange, int myUserId) { var existingExchange = exchanges.GetExchange(exchange.ExchangeId); if (existingExchange == null) { return(false); } if (existingExchange.OfferingUserId == myUserId) { existingExchange.OfferingUserFinalizeTime = DateTime.Now; } else { existingExchange.OtherUserFinalizeTime = DateTime.Now; } if (existingExchange.OtherUserFinalizeTime.Year >= 2018 && existingExchange.OfferingUserFinalizeTime.Year >= 2018) { existingExchange.State = ExchangeState.Finalized; } unitOfWork.CompleteWork(); return(true); }
public static void CopyFromEntity(OrderFullDetailsBossDto dto, TeleOrder order, Driver drv = null) { dto.order_id = order.TeleOrdID; dto.order_date = Common.ToDateFormat(order.OrderDate); dto.delivery_date = Common.ToDateFormat(order.DeliveryDate.Value); //dto.delivery_date = order.DeliveryDate.ToDateTime(); if (!(order.MDeliverySlot == null)) { dto.time_slot_id = order.MDeliverySlot.SlotID; dto.time_slot_name = order.MDeliverySlot.SlotName; } dto.invoice_number = order.InvoiceNumber; dto.order_status = order.StatusId; dto.consumer_name = order.TeleCustomers?.FirstOrDefault()?.CustomerName; dto.consumer_mobile = order.TeleCustomers?.FirstOrDefault()?.MobileNumber; dto.consumer_address = order.TeleCustomers?.FirstOrDefault()?.Address; dto.grand_total = order.GrantTotal; if (drv != null) { dto.driver_details = new DriverDetailsBossDto(); CopyFromEntity(dto.driver_details, drv); if (!(order.MOrderStatu == null)) { dto.driver_details.delivery_status = order.MOrderStatu.OrstID.ToInt(); } } List <ProductsBossDto> pdtos = new List <ProductsBossDto>(); foreach (TeleOrderDetail det in order.TeleOrderDetails) { ProductsBossDto pdt = new ProductsBossDto(); pdt.product_name = det.Product?.ProductName; pdt.product_promo = det.PromoProduct.ToDecimal(); pdt.quantity = det.Quantity; pdt.shipping_cost = det.ShippingCharge.ToDecimal(); pdt.shipping_promo = det.PromoShipping.ToDecimal(); pdt.sub_total = det.SubTotal; pdt.unit_price = det.UnitPrice; pdt.grand_total = det.TotalAmount; pdtos.Add(pdt); } dto.product_details = pdtos; dto.has_exchange = (order.TeleOrderPrdocuctExchanges.Count > 0 ? 1 : 0); if (dto.has_exchange == 1) { if (dto.exchange == null) { dto.exchange = new List <ExchangeDto>(); } foreach (var item in order.TeleOrderPrdocuctExchanges) { ExchangeDto exDto = new ExchangeDto(); TeleOrderHelper.CopyFromEntity(exDto, item); dto.exchange.Add(exDto); } } }
public static void CopyFromEntity(ExchangeDto response, ProductExchange exchange) { response.exchange_id = exchange.PrExID; response.exchange_price = exchange.ExchangePrice ?? 0M; response.exchange_promo_price = exchange.ExchangePromoPrice; response.exchange_quantity = exchange.ExchangeQuantity; response.exchange_with = exchange.ExchangeWith; }
public bool AddExchange(ExchangeDto exchange, int normalizedId) { Exchange newExchange = mappingService.GetExchangeFromExchangeDto(exchange, normalizedId); exchanges.AddExchange(newExchange); unitOfWork.CompleteWork(); return(newExchange.ExchangeId != 0); }
public IActionResult AddExchange([FromBody] ExchangeDto exchange) { var id = User.Claims.Single(c => c.Type == "Id").Value; var normalizedId = profilesService.ToNormalizedId(id); var result = exchangeService.AddExchange(exchange, normalizedId); return(result ? (IActionResult)Ok() : BadRequest()); }
public static void CopyFromEntity(ExchangeDto response, OrderPrdocuctExchange exchange) { response.exchange_id = exchange.OrdPrdExID; response.exchange_price = exchange.ExchangePrice; response.exchange_promo_price = exchange.ExchangePromoPrice / exchange.ExchangeQuantity; response.exchange_quantity = exchange.ExchangeQuantity; response.exchange_with = exchange.ExchangeWith; }
public ApiDataGenerationInitialiser( ExchangeDto market, TimeSpan tickFrequency, IReadOnlyCollection <SecurityPriceDto> securityPrices) { this._market = market ?? throw new ArgumentNullException(nameof(market)); this._tickFrequency = tickFrequency; this._securityPrices = securityPrices ?? throw new ArgumentNullException(nameof(securityPrices)); }
public async Task <object> Post([FromBody] ExchangeViewModel model) { MessageBase2 result = new MessageBase2(); ExchangeDto dto = ConvertHelper.ChangeType <ExchangeDto>(model); await _exchangeService.AddAsync(dto); return(result); }
public async Task <object> PutUpdate(int id, [FromBody] ExchangeViewModel model) { MessageBase2 result = new MessageBase2(); ExchangeDto dto = ConvertHelper.ChangeType <ExchangeDto>(model); await _exchangeService.UpdateAsync(id, dto); return(result); }
public async Task <H5ResponseViewModel <object> > PrepaidRefill([FromBody] H5RequestViewModel obj) { H5ResponseViewModel <object> response = null; var code = SysCode.Ok; bool isLog = _token.VerifyToken((string)obj.data.userOpenId, (string)obj.data.sessionToken); if (isLog) { string strJson = RedisHelper.StringGet($"{CacheKey.Token}{(string)obj.data.userOpenId}", RedisFolderEnum.token, RedisEnum.Three); UserLoginDto userLog = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson); //获取商品信息 var ofpaybyid = await _ofpay.GetOfOayByIdAsync(long.Parse((string)obj.data.ofpayId)); OfpayLogDto ofpayLog = new OfpayLogDto { CreateTime = DateTime.Now, OfPay_Id = ofpaybyid.Id, Order_Id = Guid.NewGuid().ToString(), Phone = userLog.Phone, Status = 1, UpdateTime = DateTime.Now, UserId = userLog.Userid, }; if (!await _ofpay.OfpayLogAsync(ofpayLog)) { //这里如果报错会直接进异常不会执行下面的代码 _log.Error($"话费充值接口生成本地订单错误,参数{ofpayLog}"); } if (await _ofpay.PrepaidRefillAsync(ofpayLog.Phone, ofpaybyid.Cardnum, ofpayLog.Order_Id)) { ExchangeDto exchange = new ExchangeDto { Amount = double.Parse(ofpaybyid.Currency), //总价 ForderId = ofpayLog.Order_Id, FuserId = userLog.Userid.ToString(), Name = "虚拟商品兑出", //ofpaybyid.Name, Price = double.Parse(ofpaybyid.Currency), //单价 Quantity = 1 }; //关闭章鱼兑换 // await _biz.Exchange(exchange); //从php兑出 await _accout.Exchange_php(exchange); } else { code = SysCode.Err; } _log.Info($"欧飞充值记录,参数为{ofpayLog}结果为{code}"); } else { code = SysCode.SessionTokenLose; } response = new H5ResponseViewModel <object>(code, null); return(response); }
public static void CopyFromEntity(AllOrderDetails response, Order order) { response.agentadmin_mobile = order.AgentAdmin != null ? order.AgentAdmin.MobileNumber : string.Empty; response.agentadmin_image = order.AgentAdmin != null ? ImagePathService.agentAdminImagePath + order.AgentAdmin.ProfileImage : string.Empty; response.agentadmin_name = order.AgentAdmin != null ? order.AgentAdmin.AgentAdminName : string.Empty; response.delivery_date = Common.ToDateFormat(order.DeliveryDate); response.delivery_status = order.OrderDeliveries.Count > 0 ? order.OrderDeliveries.Where(x => x.OrdrID == order.OrdrID).FirstOrDefault().StatusId : 0; response.grand_total = order.GrandTotal; response.invoice_number = order.InvoiceNumber; response.order_date = Common.ToDateFormat(order.OrderDate); response.order_id = order.OrdrID; response.order_status = order.StatusID; response.order_time = order.OrderTime.ToString(); response.time_slot_name = order.MDeliverySlot != null ? order.MDeliverySlot.SlotName : string.Empty; if (response.driver_details == null) { response.driver_details = new DriverDetailsDto(); } if (order.Driver != null) { response.driver_details.driver_id = order.Driver.DrvrID; response.driver_details.driver_name = order.Driver.DriverName; response.driver_details.driver_image = ImagePathService.driverImagePath + order.Driver.ProfileImage; response.driver_details.driver_mobile = order.Driver.MobileNumber; } else { response.driver_details.driver_name = string.Empty; response.driver_details.driver_image = string.Empty; response.driver_details.driver_mobile = string.Empty; } if (response.product_details == null) { response.product_details = new List <ProductsDto>(); } foreach (var item in order.OrderDetails) { ProductsDto prodDto = new ProductsDto(); OrdersHelper.CopyFromEntity(prodDto, item); response.product_details.Add(prodDto); } response.has_exchange = (order.OrderPrdocuctExchanges.Count > 0 ? 1 : 0); if (response.has_exchange == 1) { if (response.exchange == null) { response.exchange = new List <ExchangeDto>(); } foreach (var item in order.OrderPrdocuctExchanges) { ExchangeDto exDto = new ExchangeDto(); OrdersHelper.CopyFromEntity(exDto, item); response.exchange.Add(exDto); } } }
public static void CopyFromEntity(OrderDetailsDto dto, Order order, string agentAdminMob, bool withDetails) { dto.order_id = order.OrdrID; dto.invoice_number = order.InvoiceNumber; // driver_details : driver_name, driver_image dto.order_date = Common.ToDateFormat(order.OrderDate); // product_details : product_name, quantity, unit_price, sub_total, product_promo, shipping_cost, shipping_promo dto.order_time = order.OrderTime; dto.delivery_date = Common.ToDateFormat(order.DeliveryDate); dto.time_slot_name = order.MDeliverySlot.SlotName; dto.grand_total = order.GrandTotal; dto.order_status = order.MOrderStatu.OrderStatus; dto.agentadmin_mobile = agentAdminMob; OrderDelivery odel = order.OrderDeliveries.Count > 0 ? order.OrderDeliveries.First() : null; if (odel != null) { dto.delivery_status = odel.MDeliveryStatu.DeliveryStatus; if (odel.Driver != null) { DriverDetailsDto drvDto = new DriverDetailsDto(); dto.driver_details = drvDto; CopyFromEntity(drvDto, odel.Driver); //drvDto.driver_name = odel.Driver.DriverName; //drvDto.driver_image = odel.Driver.ProfileImage; } } if (order.OrderDetails.Count > 0) { List <OrderDetail> odetLst = order.OrderDetails.ToList(); dto.product_details = new ProductsDto[odetLst.Count]; for (int i = 0; i < odetLst.Count; i++) { ProductsDto prodDto = new ProductsDto(); CopyFromEntity(prodDto, odetLst[i]); dto.product_details[i] = prodDto; } } dto.has_exchange = (order.OrderPrdocuctExchanges.Count > 0 ? 1 : 0); if (dto.has_exchange == 1) { if (dto.exchange == null) { dto.exchange = new List <ExchangeDto>(); } foreach (var item in order.OrderPrdocuctExchanges) { ExchangeDto exDto = new ExchangeDto(); CopyFromEntity(exDto, item); dto.exchange.Add(exDto); } } }
public TradingMarkingTheCloseProcess( IReadOnlyCollection <string> markingTheCloseTargetSedols, ITradeStrategy <Order> orderStrategy, ExchangeDto marketDto, ILogger logger) : base(logger, orderStrategy) { this._markingTheCloseTargetSedols = markingTheCloseTargetSedols?.Where(cts => !string.IsNullOrWhiteSpace(cts))?.ToList() ?? new List <string>(); this._intraDayHistoryStack = new EquityIntraDayHistoryStack(TimeSpan.FromMinutes(29)); this._marketDto = marketDto ?? throw new ArgumentNullException(nameof(marketDto)); }
/// <summary> /// 查询兑换 /// </summary> /// <param name="id">兑换id</param> /// <returns></returns> public async Task <ExchangeDto> FindAsync(int id) { var v = await this.ExchangeRepository.FindAsync(ex => ex.Id == id); ExchangeDto dto = new ExchangeDto() { Title = v.Title, Official = v.Official, Postage = v.Postage.GetValueOrDefault(0), Rent = v.Rent.GetValueOrDefault(0) }; return(dto); }
public void Load_ThrowIfDomainInvalidException_WhenQueueNameIsEmpty() { //Arrange var exchangeDto = new ExchangeDto() { ExhangeName = Faker.Random.String(), ExchangeType = Faker.Random.String() }; Action queue = () => { Queue.Load(string.Empty, exchangeDto); }; //Act & Assert queue.Should().Throw <Exception>().And.Message.Should().Be("queue name should not be empty"); }
public void Load_Success_WhenDomainIsValid() { //Arrange var exchangeDto = new ExchangeDto() { ExhangeName = Faker.Random.String(), ExchangeType = Faker.Random.String() }; //Act Action exchange = () => { Exchange.Load(Faker.Random.ToString(), Faker.Random.String()); }; //Assert exchange.Should().NotBeNull(); }
/// <summary> /// queue invariants /// </summary> /// <param name="queueName"></param> /// <param name="useScheduler"></param> /// <param name="exhange"></param> /// <returns></returns> public static Queue Load(string queueName, ExchangeDto exhange) { if (string.IsNullOrEmpty(queueName)) { throw new Exception("queue name should not be empty"); } if (exhange == null) { throw new Exception("exchange should not be null"); } return(new Queue( queueName, Exchange.Load(exhange.ExhangeName, exhange.ExchangeType))); }
private void AdvanceFrames(ExchangeDto market, EquityIntraDayTimeBarCollection frame) { if (frame.Epoch.TimeOfDay > market.MarketCloseTime) { this._logger.Log(LogLevel.Error, "ended up advancing a frame whose start exceeded market close time"); return; } var timeSpanList = new List <TickStrategy>(); var advanceTick = frame.Epoch.TimeOfDay; while (advanceTick <= market.MarketCloseTime) { timeSpanList.Add(new TickStrategy { TickOffset = advanceTick, Strategy = this._dataStrategy }); advanceTick = advanceTick.Add(this._tickSeparation); } timeSpanList = this.RemoveConflictingTicks(timeSpanList); foreach (var subPlan in this._plan) { var strategy = new PlanEquityStrategy(subPlan, this._dataStrategy); var initialTick = subPlan.EquityInstructions.IntervalCommencement; while (initialTick <= subPlan.EquityInstructions.IntervalTermination) { timeSpanList.Add(new TickStrategy { TickOffset = initialTick, Strategy = strategy }); initialTick = initialTick.Add(subPlan.EquityInstructions.UpdateFrequency); } } timeSpanList = timeSpanList.OrderBy(i => i.TickOffset).ToList(); foreach (var item in timeSpanList) { if (item?.Strategy == null) { continue; } this.Tick(frame.Epoch.Date.Add(item.TickOffset), item.Strategy); } }
public static void CopyFromEntity(ConfirmPickupOrderResponse response, TeleOrder order) { PickupOrderDto odt = new PickupOrderDto(); response.orders = odt; odt.order_id = order.TeleOrdID; odt.order_date = Common.ToDateFormat(order.OrderDate); odt.invoice_number = order.InvoiceNumber; odt.order_status = order.StatusId; odt.grand_total = order.GrantTotal; //dto.oder = odtos.ToArray(); List <ProductsDto> pdtos = new List <ProductsDto>(); foreach (TeleOrderDetail det in order.TeleOrderDetails) { ProductsDto pdt = new ProductsDto(); pdt.product_id = det.Product.ProdID; pdt.product_name = det.Product.ProductName; pdt.product_promo = det.PromoProduct ?? 0M; pdt.quantity = det.Quantity; pdt.shipping_cost = det.ShippingCharge ?? 0M; pdt.shipping_promo = det.PromoShipping ?? 0M; pdt.refill_price = det.RefillPrice; pdt.refill_promo = det.PromoRefill; pdt.refill_quantity = det.RefillQuantity; pdt.sub_total = det.SubTotal; pdt.unit_price = det.UnitPrice; pdtos.Add(pdt); } odt.products = pdtos.ToArray(); odt.has_exchange = (order.TeleOrderPrdocuctExchanges.Count > 0 ? 1 : 0); if (odt.has_exchange == 1) { if (odt.exchange == null) { odt.exchange = new List <ExchangeDto>(); } foreach (var item in order.TeleOrderPrdocuctExchanges) { ExchangeDto exDto = new ExchangeDto(); TeleOrderHelper.CopyFromEntity(exDto, item); odt.exchange.Add(exDto); } } }
public bool AcceptExchange(ExchangeDto exchange) { var existingExchange = exchanges.GetExchange(exchange.ExchangeId); if (existingExchange == null) { return(false); } existingExchange.State = ExchangeState.InProgress; existingExchange.OtherUserContactInfo = exchange.MyContactInfo; exchanges.RemoveExchangeGames(existingExchange.OfferingUserId, existingExchange.OfferingUsersGames); exchanges.RemoveExchangeGames(existingExchange.OtherUserId, existingExchange.OtherUsersGames); exchanges.DeclineWaitingExchanges(existingExchange.OfferingUserId, existingExchange.OfferingUsersGames, existingExchange.ExchangeId); exchanges.DeclineWaitingExchanges(existingExchange.OtherUserId, existingExchange.OtherUsersGames, existingExchange.ExchangeId); unitOfWork.CompleteWork(); return(true); }
/// <summary> /// 添加兑换 /// </summary> /// <param name="dto"></param> /// <returns></returns> public async Task <bool> AddAsync(ExchangeDto dto) { var model = ConvertHelper.ChangeType <Exchange>(dto); model.AddTime = DateTime.Now; model.Status = 1; model.Examine = "1"; model.Valuation1 = ""; model.Valuation2 = ""; model.Valuation3 = ""; model.Vote1 = 0; model.Vote2 = 0; model.Vote3 = 0; model = await this.ExchangeRepository.AddAsync(model); return(model.Id > 0); }
public bool Update2(int id, ExchangeDto dto) { var model = this.ExchangeRepository.Find(ex => ex.Id == id); model.Title = dto.Title; model.Constitute = dto.Constitute; model.Source = dto.Source; model.ClassId = dto.ClassId.ToString(); model.Examine = dto.ExamineId.ToString(); model.Describe = dto.Describe; model.Price = dto.Price; model.ItemCharacter = dto.ItemCharacter; model.ItemName = dto.ItemName; model.Official = dto.Official; return(this.ExchangeRepository.Update(model)); }
/// <summary> /// 修改兑换 /// </summary> /// <param name="id">兑换id</param> /// <param name="dto"></param> /// <returns></returns> public async Task <bool> UpdateAsync(int id, ExchangeDto dto) { var model = await this.ExchangeRepository.FindAsync(ex => ex.Id == id); model.ClassId = dto.ClassId.ToString(); model.Constitute = dto.Constitute; model.Cover = dto.Cover; model.Describe = dto.Describe; model.ImgList = dto.ImgList; model.ItemCharacter = dto.ItemCharacter; model.ItemName = dto.ItemName; model.Price = dto.Price; model.Source = dto.Source; model.Title = dto.Title; return(await this.ExchangeRepository.UpdateAsync(model)); }