Compare commits
No commits in common. "8577d2681292c6f186a60e50f703a8ee9c78ea53" and "83be60e4d2ed01c9be964992515934b63c54a4b8" have entirely different histories.
8577d26812
...
83be60e4d2
|
|
@ -77,12 +77,8 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Controllers
|
||||||
Message = viewModel.Body,
|
Message = viewModel.Body,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var jsonMessage = JsonConvert.SerializeObject(announcement, Formatting.Indented,
|
||||||
var jsonMessage = JsonConvert.SerializeObject(announcement, Formatting.Indented, new JsonSerializerSettings
|
new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() });
|
||||||
{
|
|
||||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
|
||||||
});
|
|
||||||
|
|
||||||
await _logger.InformationAsync($"sending announcements");
|
await _logger.InformationAsync($"sending announcements");
|
||||||
await _announcementHubContext.Clients.All.SendAsync("send", jsonMessage);
|
await _announcementHubContext.Clients.All.SendAsync("send", jsonMessage);
|
||||||
//await _announcementHubContext.Clients.All.SendAsync("send", viewModel.Body.ToString());
|
//await _announcementHubContext.Clients.All.SendAsync("send", viewModel.Body.ToString());
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ public class AuctionPluginAdminController : BasePluginController
|
||||||
private readonly INotificationService _notificationService;
|
private readonly INotificationService _notificationService;
|
||||||
private readonly ISettingService _settingService;
|
private readonly ISettingService _settingService;
|
||||||
private readonly AuctionSettings _auctionSettings;
|
private readonly AuctionSettings _auctionSettings;
|
||||||
private readonly AuctionService _auctionService;
|
private readonly IAuctionService _auctionService;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
//public AuctionPluginAdminController(SignalRservice signalRservice)
|
//public AuctionPluginAdminController(SignalRservice signalRservice)
|
||||||
public AuctionPluginAdminController(ILocalizationService localizationService, INotificationService notificationService, ISettingService settingService, AuctionSettings auctionSettings, ILogger logger, AuctionService auctionService)
|
public AuctionPluginAdminController(ILocalizationService localizationService, INotificationService notificationService, ISettingService settingService, AuctionSettings auctionSettings, ILogger logger, IAuctionService auctionService)
|
||||||
{
|
{
|
||||||
_localizationService = localizationService;
|
_localizationService = localizationService;
|
||||||
_notificationService = notificationService;
|
_notificationService = notificationService;
|
||||||
|
|
@ -148,9 +148,7 @@ public class AuctionPluginAdminController : BasePluginController
|
||||||
var model = new TestPageViewModel();
|
var model = new TestPageViewModel();
|
||||||
|
|
||||||
var auctions = await _auctionService.GetAllAuctionsAsync();
|
var auctions = await _auctionService.GetAllAuctionsAsync();
|
||||||
var auctionDtoWithProducts = await _auctionService.GetAuctionDtoWithProductByIdAsync(1, 4);
|
model.Message = $"Teszt üzenet; Auctions count: {auctions.Count}";
|
||||||
|
|
||||||
model.Message = $"Teszt üzenet; Auctions count: {auctions.Count}; Products count: {auctionDtoWithProducts.ProductToAuctionDtos.Count}";
|
|
||||||
|
|
||||||
return View("~/Plugins/Misc.AuctionPlugin/Areas/Admin/Views/TestPage.cshtml", model);
|
return View("~/Plugins/Misc.AuctionPlugin/Areas/Admin/Views/TestPage.cshtml", model);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Controllers;
|
||||||
public class AuctionController : BasePluginController
|
public class AuctionController : BasePluginController
|
||||||
{
|
{
|
||||||
|
|
||||||
protected readonly AuctionService _auctionService;
|
protected readonly IAuctionService _auctionService;
|
||||||
protected readonly ILogger _logger;
|
protected readonly ILogger _logger;
|
||||||
protected readonly IProductService _productService;
|
protected readonly IProductService _productService;
|
||||||
protected readonly MyProductModelFactory _productModelFactory;
|
protected readonly MyProductModelFactory _productModelFactory;
|
||||||
|
|
||||||
public AuctionController(AuctionService auctionService, ILogger logger, IProductService productService, MyProductModelFactory productModelFactory)
|
public AuctionController(IAuctionService auctionService, ILogger logger, IProductService productService, MyProductModelFactory productModelFactory)
|
||||||
{
|
{
|
||||||
_auctionService = auctionService;
|
_auctionService = auctionService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,27 @@
|
||||||
using Mango.Nop.Core.Repositories;
|
using Mango.Nop.Core.Repositories;
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
using Nop.Data;
|
using Nop.Data;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
|
||||||
|
|
||||||
public class AuctionDbContext : MgDbContextBase, IAuctionDbSet<AuctionDbTable>, IProductToAuctionDbSet<ProductToAuctionDbTable>, IAuctionBidDbSet<AuctionBidDbTable>
|
public class AuctionDbContext : MgDbContextBase, IAuctionDbSet<AuctionDbTable>, IAuctionBidDbSet<AuctionBidDbTable>
|
||||||
{
|
{
|
||||||
public AuctionDbTable Auctions { get; set; }
|
public AuctionDbTable Auctions { get; set; }
|
||||||
public ProductToAuctionDbTable ProductToAuctions { get; set; }
|
|
||||||
public AuctionBidDbTable AuctionBids { get; set; }
|
public AuctionBidDbTable AuctionBids { get; set; }
|
||||||
|
|
||||||
|
public EntityRepository<Auction> Auctions2 { get; set; }
|
||||||
//public EntityRepository<Auction> Auctions2 { get; set; }
|
public IRepository<AuctionBid> AuctionBids2 { get; set; }
|
||||||
//public IRepository<AuctionBid> AuctionBids2 { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public AuctionDbContext(INopDataProvider dataProvider, AuctionDbTable auctionDbTable, ProductToAuctionDbTable productToAuctionDbTable, AuctionBidDbTable auctionBidDbTable) : base(dataProvider)
|
public AuctionDbContext(INopDataProvider dataProvider, AuctionDbTable auctionDbTable, AuctionBidDbTable auctionBidDbTable) : base(dataProvider)
|
||||||
{
|
{
|
||||||
Auctions = auctionDbTable;
|
Auctions = auctionDbTable;
|
||||||
ProductToAuctions = productToAuctionDbTable;
|
|
||||||
AuctionBids = auctionBidDbTable;
|
AuctionBids = auctionBidDbTable;
|
||||||
|
|
||||||
//Auctions.Table
|
//Auctions.Table
|
||||||
//var auctions = DataProvider.GetTable<Auction>().Where(x => x.Closed);
|
var auctions = DataProvider.GetTable<Auction>().Where(x => x.Closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public AuctionDbContext(IRepository<Auction> _auctionRepository, IRepository<AuctionBid> _auctionBidRepository)
|
//public AuctionDbContext(IRepository<Auction> _auctionRepository, IRepository<AuctionBid> _auctionBidRepository)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using Nop.Data;
|
using Nop.Data;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer.Interfaces;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
|
||||||
|
|
||||||
public interface IAuctionBidDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<AuctionBid>
|
public interface IAuctionBidDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<AuctionBid>
|
||||||
{
|
{
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using Nop.Data;
|
using Nop.Data;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer.Interfaces;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
|
||||||
|
|
||||||
public interface IAuctionDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<Auction>
|
public interface IAuctionDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<Auction>
|
||||||
{
|
{
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
using Mango.Nop.Core.Interfaces;
|
|
||||||
using Nop.Data;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer.Interfaces;
|
|
||||||
|
|
||||||
public interface IProductToAuctionDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<ProductToAuctionMapping>
|
|
||||||
{
|
|
||||||
public TDbTable ProductToAuctions { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
using Mango.Nop.Core.Repositories;
|
|
||||||
using Nop.Core.Caching;
|
|
||||||
using Nop.Core.Configuration;
|
|
||||||
using Nop.Core.Events;
|
|
||||||
using Nop.Data;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
|
|
||||||
|
|
||||||
public class ProductToAuctionDbTable: MgDbTableBase<ProductToAuctionMapping>
|
|
||||||
{
|
|
||||||
public ProductToAuctionDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IQueryable<ProductToAuctionMapping> GetByAuctionAndProductId(int auctionId, int productId)
|
|
||||||
{
|
|
||||||
return Table.Where(x => x.AuctionId == auctionId && x.ProductId == productId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
|
||||||
|
|
||||||
public class AuctionBidDto : IAuctionBidDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int ProductAuctionMappingId { get; set; }
|
|
||||||
public int CustomerId { get; set; }
|
|
||||||
public int ProductId { get; set; }
|
|
||||||
public bool IsWinner { get; set; }
|
|
||||||
public int BidPrice { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public AuctionBidDto()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuctionBidDto(AuctionBid auctionBid)
|
|
||||||
{
|
|
||||||
Id = auctionBid.Id;
|
|
||||||
ProductAuctionMappingId = auctionBid.ProductAuctionMappingId;
|
|
||||||
CustomerId = auctionBid.CustomerId;
|
|
||||||
ProductId = auctionBid.ProductId;
|
|
||||||
IsWinner = auctionBid.IsWinner;
|
|
||||||
BidPrice = auctionBid.BidPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuctionBid CreateMainEntity()
|
|
||||||
{
|
|
||||||
var mainEntity = Activator.CreateInstance<AuctionBid>();
|
|
||||||
|
|
||||||
mainEntity.Id = Id;
|
|
||||||
mainEntity.ProductAuctionMappingId = ProductAuctionMappingId;
|
|
||||||
mainEntity.CustomerId = CustomerId;
|
|
||||||
mainEntity.ProductId = ProductId;
|
|
||||||
mainEntity.IsWinner = IsWinner;
|
|
||||||
mainEntity.BidPrice = BidPrice;
|
|
||||||
|
|
||||||
|
|
||||||
return mainEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
|
||||||
|
|
||||||
public class AuctionDto : IAuctionDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string AuctionName { get; set; }
|
|
||||||
public AuctionType AuctionType { get; set; }
|
|
||||||
public DateTime StartDateUtc { get; set; }
|
|
||||||
public DateTime? EndDateUtc { get; set; }
|
|
||||||
public bool Closed { get; set; }
|
|
||||||
|
|
||||||
public List<ProductToAuctionDto> ProductToAuctionDtos { get; } = [];
|
|
||||||
|
|
||||||
public AuctionDto()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuctionDto(Auction auction)
|
|
||||||
{
|
|
||||||
Id = auction.Id;
|
|
||||||
AuctionName = auction.AuctionName;
|
|
||||||
AuctionType = auction.AuctionType;
|
|
||||||
StartDateUtc = auction.StartDateUtc;
|
|
||||||
EndDateUtc = auction.EndDateUtc;
|
|
||||||
Closed = auction.Closed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Auction CreateMainEntity()
|
|
||||||
{
|
|
||||||
var mainEntity = Activator.CreateInstance<Auction>();
|
|
||||||
|
|
||||||
mainEntity.Id = Id;
|
|
||||||
mainEntity.AuctionName = AuctionName;
|
|
||||||
mainEntity.AuctionType = AuctionType;
|
|
||||||
mainEntity.StartDateUtc = StartDateUtc;
|
|
||||||
mainEntity.EndDateUtc = EndDateUtc;
|
|
||||||
mainEntity.Closed = Closed;
|
|
||||||
|
|
||||||
return mainEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
using Mango.Nop.Core.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
public interface IAuctionBidDto : IAuctionBidDtoBase, IMgModelDtoBase<AuctionBid>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
using Mango.Nop.Core.Interfaces;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
public interface IAuctionBidDtoBase : IMgModelDtoBase
|
|
||||||
{
|
|
||||||
public int ProductAuctionMappingId { get; set; }
|
|
||||||
|
|
||||||
public int CustomerId { get; set; }
|
|
||||||
|
|
||||||
public int ProductId { get; set; }
|
|
||||||
|
|
||||||
public bool IsWinner { get; set; }
|
|
||||||
public int BidPrice { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
using AyCode.Interfaces;
|
|
||||||
using AyCode.Interfaces.Server.Logins;
|
|
||||||
using AyCode.Interfaces.Users.Dtos;
|
|
||||||
using Mango.Nop.Core.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
public interface IAuctionDto : IAuctionDtoBase, IMgModelDtoBase<Auction>
|
|
||||||
{
|
|
||||||
//[NotMapped]
|
|
||||||
//[NotColumn]
|
|
||||||
public List<ProductToAuctionDto> ProductToAuctionDtos { get; }
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
using AyCode.Interfaces;
|
|
||||||
using Mango.Nop.Core.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
public interface IAuctionDtoBase : IMgModelDtoBase
|
|
||||||
{
|
|
||||||
public string AuctionName { get; set; }
|
|
||||||
|
|
||||||
public AuctionType AuctionType { get; set; }
|
|
||||||
|
|
||||||
public DateTime StartDateUtc { get; set; }
|
|
||||||
public DateTime? EndDateUtc { get; set; }
|
|
||||||
|
|
||||||
public bool Closed { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
using Mango.Nop.Core.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
public interface IProductToAuctionDto : IProductToAuctionDtoBase, IMgModelDtoBase<ProductToAuctionMapping>
|
|
||||||
{
|
|
||||||
public List<AuctionBidDto> AuctionBidDtos { get; }
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
using Mango.Nop.Core.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
public interface IProductToAuctionDtoBase : IMgModelDtoBase
|
|
||||||
{
|
|
||||||
public int ProductId { get; set; }
|
|
||||||
public int AuctionId { get; set; }
|
|
||||||
|
|
||||||
public AuctionStatus AuctionStatus { get; set; }
|
|
||||||
|
|
||||||
public int StartingPrice { get; set; }
|
|
||||||
public int BidPrice { get; set; }
|
|
||||||
|
|
||||||
public int BidAmount { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
|
||||||
|
|
||||||
public class ProductToAuctionDto : IProductToAuctionDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int ProductId { get; set; }
|
|
||||||
public int AuctionId { get; set; }
|
|
||||||
public AuctionStatus AuctionStatus { get; set; }
|
|
||||||
public int StartingPrice { get; set; }
|
|
||||||
public int BidPrice { get; set; }
|
|
||||||
public int BidAmount { get; set; }
|
|
||||||
|
|
||||||
public List<AuctionBidDto> AuctionBidDtos { get; } = [];
|
|
||||||
|
|
||||||
|
|
||||||
public ProductToAuctionDto()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProductToAuctionDto(ProductToAuctionMapping productToAuction)
|
|
||||||
{
|
|
||||||
Id = productToAuction.Id;
|
|
||||||
ProductId = productToAuction.ProductId;
|
|
||||||
AuctionId = productToAuction.AuctionId;
|
|
||||||
AuctionStatus = productToAuction.AuctionStatus;
|
|
||||||
StartingPrice = productToAuction.StartingPrice;
|
|
||||||
BidPrice = productToAuction.BidPrice;
|
|
||||||
BidAmount = productToAuction.BidAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProductToAuctionMapping CreateMainEntity()
|
|
||||||
{
|
|
||||||
var mainEntity = Activator.CreateInstance<ProductToAuctionMapping>();
|
|
||||||
|
|
||||||
mainEntity.Id = Id;
|
|
||||||
mainEntity.ProductId = ProductId;
|
|
||||||
mainEntity.AuctionId = AuctionId;
|
|
||||||
mainEntity.AuctionStatus = AuctionStatus;
|
|
||||||
mainEntity.StartingPrice = StartingPrice;
|
|
||||||
mainEntity.BidPrice = BidPrice;
|
|
||||||
mainEntity.BidAmount = BidAmount;
|
|
||||||
|
|
||||||
return mainEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +1,18 @@
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using AyCode.Interfaces.Entities;
|
||||||
|
using AyCode.Interfaces.TimeStampInfo;
|
||||||
using LinqToDB.Mapping;
|
using LinqToDB.Mapping;
|
||||||
using Mango.Nop.Core.Entities;
|
using Mango.Nop.Core.Entities;
|
||||||
using Mango.Nop.Core.Interfaces;
|
using Mango.Nop.Core.Interfaces;
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||||
|
|
||||||
public partial class Auction: MgEntityBase, IAuction
|
public partial class Auction: MgEntityBase, ITimeStampInfo//, ISoftRemoveEntityInt
|
||||||
{
|
{
|
||||||
public string AuctionName { get; set; }
|
public string AuctionName { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
|
||||||
[NotColumn]
|
|
||||||
public AuctionType AuctionType{ get; set; }
|
public AuctionType AuctionType{ get; set; }
|
||||||
|
|
||||||
public DateTime StartDateUtc { get; set; }
|
public DateTime StartDateUtc { get; set; }
|
||||||
|
|
@ -21,6 +20,10 @@ public partial class Auction: MgEntityBase, IAuction
|
||||||
|
|
||||||
public bool Closed { get; set; }
|
public bool Closed { get; set; }
|
||||||
|
|
||||||
|
[NotMapped]
|
||||||
|
[NotColumn]
|
||||||
|
public List<ProductToAuctionMapping> ProductToAuctionMappings { get; } = [];
|
||||||
|
|
||||||
[SkipValuesOnUpdate]
|
[SkipValuesOnUpdate]
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
using AyCode.Interfaces.Entities;
|
using AyCode.Interfaces.Entities;
|
||||||
using LinqToDB.Mapping;
|
using AyCode.Interfaces.TimeStampInfo;
|
||||||
using Mango.Nop.Core.Entities;
|
using Mango.Nop.Core.Entities;
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities.Interfaces;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
||||||
{
|
{
|
||||||
public partial class AuctionBid : MgEntityBase, IAuctionBid
|
public partial class AuctionBid : MgEntityBase, ITimeStampInfo//, ISoftRemoveEntityInt
|
||||||
{
|
{
|
||||||
public int ProductAuctionMappingId { get; set; }
|
public int ProductAuctionMappingId { get; set; }
|
||||||
|
|
||||||
|
|
@ -17,7 +16,8 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
||||||
public bool IsWinner { get; set; }
|
public bool IsWinner { get; set; }
|
||||||
public int BidPrice { get; set; }
|
public int BidPrice { get; set; }
|
||||||
|
|
||||||
[SkipValuesOnUpdate]
|
public DateTime CreateDate { get; set; }
|
||||||
|
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using AyCode.Interfaces.Entities;
|
using AyCode.Interfaces.Entities;
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
using AyCode.Interfaces.TimeStampInfo;
|
||||||
using LinqToDB.Mapping;
|
|
||||||
using Mango.Nop.Core.Entities;
|
using Mango.Nop.Core.Entities;
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
|
|
||||||
|
|
@ -8,7 +7,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||||
|
|
||||||
public partial class AuctionItem : MgEntityBase, ITimeStampInfo//, ISoftRemoveEntityInt
|
public partial class AuctionItem : MgEntityBase, ITimeStampInfo//, ISoftRemoveEntityInt
|
||||||
{
|
{
|
||||||
[SkipValuesOnUpdate]
|
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
using AyCode.Interfaces.Entities;
|
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities.Interfaces;
|
|
||||||
|
|
||||||
public interface IAuction : IAuctionDtoBase, ITimeStampInfo //, ISoftRemoveEntityInt
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities.Interfaces;
|
|
||||||
|
|
||||||
public interface IAuctionBid : IAuctionBidDtoBase, ITimeStampInfo//, ISoftRemoveEntityInt
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos.Interfaces;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities.Interfaces;
|
|
||||||
|
|
||||||
public interface IProductToAuctionMapping : IProductToAuctionDtoBase, ITimeStampInfo //, ISoftRemoveEntityInt
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +1,23 @@
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using AyCode.Interfaces.Entities;
|
||||||
using AyCode.Interfaces.Entities;
|
using AyCode.Interfaces.TimeStampInfo;
|
||||||
using LinqToDB.Mapping;
|
using LinqToDB.Mapping;
|
||||||
using Mango.Nop.Core.Entities;
|
using Mango.Nop.Core.Entities;
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities.Interfaces;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Enums;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||||
|
|
||||||
public partial class ProductToAuctionMapping : MgEntityBase, IProductToAuctionMapping
|
public partial class ProductToAuctionMapping : MgEntityBase, ITimeStampInfo//, ISoftRemoveEntityInt
|
||||||
{
|
{
|
||||||
public int ProductId { get; set; }
|
public int ProductId { get; set; }
|
||||||
public int AuctionId { get; set; }
|
public int AuctionId { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
|
||||||
[NotColumn]
|
[NotColumn]
|
||||||
public AuctionStatus AuctionStatus { get; set; }
|
public AuctionStatus AuctionStatus { get; set; } = AuctionStatus.None;
|
||||||
|
|
||||||
public int StartingPrice { get; set; }
|
public int StartingPrice { get; set; }
|
||||||
public int BidPrice { get; set; }
|
public int BidPrice { get; set; }
|
||||||
|
|
||||||
public int BidAmount { get; set; } = 1;
|
public int BidAmount { get; set; } = 1;
|
||||||
|
|
||||||
[SkipValuesOnUpdate]
|
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using AyCode.Core.Extensions;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Mvc.Razor;
|
using Microsoft.AspNetCore.Mvc.Razor;
|
||||||
using Microsoft.AspNetCore.Mvc.Routing;
|
using Microsoft.AspNetCore.Mvc.Routing;
|
||||||
|
|
@ -7,8 +6,6 @@ using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Serialization;
|
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
using Nop.Core.Caching;
|
using Nop.Core.Caching;
|
||||||
using Nop.Core.Infrastructure;
|
using Nop.Core.Infrastructure;
|
||||||
|
|
@ -19,6 +16,7 @@ using Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||||
using Nop.Services.Catalog;
|
using Nop.Services.Catalog;
|
||||||
using Nop.Services.Configuration;
|
using Nop.Services.Configuration;
|
||||||
using Nop.Services.Localization;
|
using Nop.Services.Localization;
|
||||||
|
using Nop.Web.Areas.Admin.Factories;
|
||||||
using Nop.Web.Framework;
|
using Nop.Web.Framework;
|
||||||
using Nop.Web.Framework.Mvc.Routing;
|
using Nop.Web.Framework.Mvc.Routing;
|
||||||
|
|
||||||
|
|
@ -54,16 +52,15 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
||||||
services.AddScoped<EventConsumer>();
|
services.AddScoped<EventConsumer>();
|
||||||
services.AddScoped<IWorkContext, WebWorkContext>();
|
services.AddScoped<IWorkContext, WebWorkContext>();
|
||||||
services.AddScoped<IAnnouncementService, AnnouncementService>();
|
services.AddScoped<IAnnouncementService, AnnouncementService>();
|
||||||
services.AddScoped<AuctionService>();
|
services.AddScoped<IAuctionService, AuctionService>();
|
||||||
services.AddScoped<IProductAttributeService, ProductAttributeService>();
|
services.AddScoped<IProductAttributeService, ProductAttributeService>();
|
||||||
services.AddScoped<UrlHelperFactory>();
|
services.AddScoped<UrlHelperFactory>();
|
||||||
services.AddScoped<IActionContextAccessor, ActionContextAccessor>();
|
services.AddScoped<IActionContextAccessor, ActionContextAccessor>();
|
||||||
|
|
||||||
services.AddScoped<AuctionDbTable>();
|
services.AddScoped<AuctionDbTable>();
|
||||||
services.AddScoped<ProductToAuctionDbTable>();
|
|
||||||
services.AddScoped<AuctionBidDbTable>();
|
services.AddScoped<AuctionBidDbTable>();
|
||||||
services.AddScoped<AuctionDbContext>();
|
services.AddScoped<AuctionDbContext>();
|
||||||
|
//services.AddSingleton<IWidgetModelFactory, WidgetModelFactory>();
|
||||||
services.AddScoped<MyProductModelFactory>();
|
services.AddScoped<MyProductModelFactory>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,10 +70,6 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
||||||
/// <param name="application">Builder for configuring an application's request pipeline</param>
|
/// <param name="application">Builder for configuring an application's request pipeline</param>
|
||||||
public void Configure(IApplicationBuilder application)
|
public void Configure(IApplicationBuilder application)
|
||||||
{
|
{
|
||||||
SerializeObjectExtensions.Options.PreserveReferencesHandling = PreserveReferencesHandling.Objects;
|
|
||||||
SerializeObjectExtensions.Options.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
|
||||||
SerializeObjectExtensions.Options.NullValueHandling = NullValueHandling.Ignore;
|
|
||||||
SerializeObjectExtensions.Options.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
|
||||||
|
|
||||||
application.UseEndpoints(endpoints =>
|
application.UseEndpoints(endpoints =>
|
||||||
{
|
{
|
||||||
|
|
@ -86,6 +79,5 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
||||||
options.AllowAnyMethod().AllowAnyHeader().AllowCredentials().SetIsOriginAllowed((hosts) => true);
|
options.AllowAnyMethod().AllowAnyHeader().AllowCredentials().SetIsOriginAllowed((hosts) => true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,7 +25,7 @@ public class ProductToAuctionMappingBuilder : NopEntityBuilder<ProductToAuctionM
|
||||||
.WithColumn(nameof(ProductToAuctionMapping.AuctionId)).AsInt32().ForeignKey<Auction>(onDelete: Rule.None) //Rule.Cascade??
|
.WithColumn(nameof(ProductToAuctionMapping.AuctionId)).AsInt32().ForeignKey<Auction>(onDelete: Rule.None) //Rule.Cascade??
|
||||||
.WithColumn(nameof(ProductToAuctionMapping.ProductId)).AsInt32().ForeignKey<Product>(onDelete: Rule.None) //Rule.Cascade??
|
.WithColumn(nameof(ProductToAuctionMapping.ProductId)).AsInt32().ForeignKey<Product>(onDelete: Rule.None) //Rule.Cascade??
|
||||||
|
|
||||||
//.WithColumn(nameof(ProductToAuctionMapping.AuctionStatus)).AsByte().NotNullable() //enum??? - J.
|
.WithColumn(nameof(ProductToAuctionMapping.AuctionStatus)).AsByte().NotNullable() //enum??? - J.
|
||||||
|
|
||||||
.WithColumn(nameof(ProductToAuctionMapping.StartingPrice)).AsInt32().NotNullable()
|
.WithColumn(nameof(ProductToAuctionMapping.StartingPrice)).AsInt32().NotNullable()
|
||||||
.WithColumn(nameof(ProductToAuctionMapping.BidPrice)).AsInt32().NotNullable()
|
.WithColumn(nameof(ProductToAuctionMapping.BidPrice)).AsInt32().NotNullable()
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
||||||
|
|
||||||
public AnnouncementService(IRepository<Announcement> announcementRepository)
|
public AnnouncementService(IRepository<Announcement> announcementRepository)
|
||||||
{
|
{
|
||||||
|
|
||||||
_announcementRepository = announcementRepository;
|
_announcementRepository = announcementRepository;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -32,56 +34,86 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
||||||
|
|
||||||
public async Task DeleteAsync(Announcement announcement)
|
public async Task DeleteAsync(Announcement announcement)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _announcementRepository.DeleteAsync(announcement);
|
await _announcementRepository.DeleteAsync(announcement);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<bool> UpdateAsync(Announcement announcement)
|
public async Task<bool> UpdateAsync(Announcement announcement)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (announcement == null) throw new ArgumentNullException("customer");
|
|
||||||
|
if (announcement == null)
|
||||||
|
|
||||||
|
throw new ArgumentNullException("customer");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _announcementRepository.UpdateAsync(announcement);
|
await _announcementRepository.UpdateAsync(announcement);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task InsertAsync(Announcement announcement)
|
public async Task InsertAsync(Announcement announcement)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
await _announcementRepository.InsertAsync(announcement);
|
await _announcementRepository.InsertAsync(announcement);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<IPagedList<Announcement>> GetAnnouncementsAsync(int pageIndex = 0, int pageSize = int.MaxValue)
|
public async Task<IPagedList<Announcement>> GetAnnouncementsAsync(int pageIndex = 0, int pageSize = int.MaxValue)
|
||||||
{
|
|
||||||
var announcements = _announcementRepository.Table.OrderBy(announcement => announcement.IsActive).ToList();
|
|
||||||
|
|
||||||
return new PagedList<Announcement>(announcements, pageIndex, pageSize);
|
{
|
||||||
|
|
||||||
|
var query = from c in _announcementRepository.Table
|
||||||
|
|
||||||
|
select c;
|
||||||
|
|
||||||
|
var query2 = query.OrderBy(b => b.IsActive).ToList();
|
||||||
|
|
||||||
|
var liveAnnouncementDomain = new PagedList<Announcement>(query2, pageIndex, pageSize);
|
||||||
|
|
||||||
|
return liveAnnouncementDomain;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Announcement> GetAnnouncementDesignFirstAsync()
|
public async Task<Announcement> GetAnnouncementDesignFirstAsync()
|
||||||
|
|
||||||
{
|
{
|
||||||
return await _announcementRepository.Table.FirstOrDefaultAsync(announcement => announcement.IsActive == true);
|
var result = await _announcementRepository.GetAllAsync(query =>
|
||||||
|
{
|
||||||
|
query = query.Where(record => record.IsActive == true);
|
||||||
|
return query;
|
||||||
|
});
|
||||||
|
|
||||||
//var result = await _announcementRepository.GetAllAsync(announcements => announcements.Where(record => record.IsActive == true));
|
//var query = from c in _announcementRepository.Table
|
||||||
|
|
||||||
////var query = from c in _announcementRepository.Table
|
// where c.IsActive == true
|
||||||
|
|
||||||
//// where c.IsActive == true
|
// orderby c.CreateDate descending
|
||||||
|
|
||||||
//// orderby c.CreateDate descending
|
// select c;
|
||||||
|
|
||||||
//// select c;
|
var LatestAnnouncement = result.ToList().FirstOrDefault();
|
||||||
|
|
||||||
//var LatestAnnouncement = result.ToList().FirstOrDefault();
|
return LatestAnnouncement;
|
||||||
|
|
||||||
//return LatestAnnouncement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Announcement> GetAnnouncementByIdAsync(int id)
|
public async Task<Announcement> GetAnnouncementByIdAsync(int Id)
|
||||||
|
|
||||||
{
|
{
|
||||||
return await _announcementRepository.GetByIdAsync(id);
|
|
||||||
|
return await _announcementRepository.GetByIdAsync(Id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ using Nop.Core.Domain.Customers;
|
||||||
using Nop.Data;
|
using Nop.Data;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer;
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Dtos;
|
|
||||||
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
using Nop.Plugin.Misc.AuctionPlugin.Domains.Entities;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Services;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||||
|
|
@ -43,7 +42,7 @@ public class AuctionService : IAuctionService
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ctor
|
/// Ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ctx"></param>
|
/// <param name="customerBidRepository">Store pickup point repository</param>
|
||||||
/// <param name="shortTermCacheManager">Short term cache manager</param>
|
/// <param name="shortTermCacheManager">Short term cache manager</param>
|
||||||
/// <param name="staticCacheManager">Cache manager</param>
|
/// <param name="staticCacheManager">Cache manager</param>
|
||||||
public AuctionService(AuctionDbContext ctx, IRepository<Auction> auctionRepository, IRepository<ProductToAuctionMapping> productToAuctionRepository, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, IWorkContext workContext)
|
public AuctionService(AuctionDbContext ctx, IRepository<Auction> auctionRepository, IRepository<ProductToAuctionMapping> productToAuctionRepository, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, IWorkContext workContext)
|
||||||
|
|
@ -64,6 +63,8 @@ public class AuctionService : IAuctionService
|
||||||
private async Task<bool> ValidateAuctionBid(AuctionBid auctionBid)
|
private async Task<bool> ValidateAuctionBid(AuctionBid auctionBid)
|
||||||
{
|
{
|
||||||
auctionBid.CustomerId = (await _workContext.GetCurrentCustomerAsync()).Id; //elvileg megnézi cache-ben, csak utána DB-zik! - J.
|
auctionBid.CustomerId = (await _workContext.GetCurrentCustomerAsync()).Id; //elvileg megnézi cache-ben, csak utána DB-zik! - J.
|
||||||
|
auctionBid.Modified = DateTime.UtcNow;
|
||||||
|
|
||||||
//etc...
|
//etc...
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -145,32 +146,7 @@ public class AuctionService : IAuctionService
|
||||||
//return (await _ctx.Auctions.GetAllAsync(auctions => auctions.OrderByDescending(x => x.StartDateUtc), _ => default)).ToList();
|
//return (await _ctx.Auctions.GetAllAsync(auctions => auctions.OrderByDescending(x => x.StartDateUtc), _ => default)).ToList();
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Dtos
|
|
||||||
public async Task<AuctionDto> GetAuctionDtoByIdAsync(int auctionId)
|
|
||||||
{
|
|
||||||
return new AuctionDto(await _ctx.Auctions.GetByIdAsync(auctionId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<AuctionDto> GetAuctionDtoWithProductByIdAsync(int auctionId, int productId)
|
|
||||||
{
|
|
||||||
var auctionModel = new AuctionDto(await _ctx.Auctions.GetByIdAsync(auctionId));
|
|
||||||
auctionModel.ProductToAuctionDtos.AddRange(await _ctx.ProductToAuctions.GetByAuctionAndProductId(auctionId, productId).Select(x => new ProductToAuctionDto(x)).ToListAsync());
|
|
||||||
|
|
||||||
return auctionModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<ProductToAuctionDto> GetProductToAuctionDtoByIdAsync(int productToAuctionId)
|
|
||||||
{
|
|
||||||
return new ProductToAuctionDto(await _ctx.ProductToAuctions.GetByIdAsync(productToAuctionId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<AuctionBidDto> GetAuctionBidDtoByIdAsync(int auctionBidId)
|
|
||||||
{
|
|
||||||
return new AuctionBidDto(await _ctx.AuctionBids.GetByIdAsync(auctionBidId));
|
|
||||||
}
|
|
||||||
public async Task<bool> AssignProductToAuctionAsync(int productId, int auctionId)
|
public async Task<bool> AssignProductToAuctionAsync(int productId, int auctionId)
|
||||||
{
|
{
|
||||||
var auction = await _ctx.Auctions.GetByIdAsync(auctionId);
|
var auction = await _ctx.Auctions.GetByIdAsync(auctionId);
|
||||||
|
|
@ -187,5 +163,7 @@ public class AuctionService : IAuctionService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Dtos
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,18 @@
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Nop.Core.Domain.Catalog;
|
using Nop.Core.Domain.Catalog;
|
||||||
|
using Nop.Core.Domain.Customers;
|
||||||
|
using Nop.Core.Domain.Messages;
|
||||||
|
using Nop.Core.Domain.Orders;
|
||||||
using Nop.Core.Events;
|
using Nop.Core.Events;
|
||||||
using Nop.Services.Events;
|
using Nop.Services.Events;
|
||||||
|
using Nop.Services.Messages;
|
||||||
|
using Nop.Web.Framework;
|
||||||
|
using Nop.Web.Framework.Events;
|
||||||
|
using Nop.Web.Framework.Models;
|
||||||
|
using Nop.Web.Models.Catalog;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Services;
|
namespace Nop.Plugin.Misc.AuctionPlugin;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents plugin event consumer
|
/// Represents plugin event consumer
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
||||||
|
|
||||||
{
|
{
|
||||||
public interface IAnnouncementService
|
public interface IAnnouncementService
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
public Task DeleteAsync(Announcement announcement);
|
public Task DeleteAsync(Announcement announcement);
|
||||||
|
|
||||||
public Task InsertAsync(Announcement announcement);
|
public Task InsertAsync(Announcement announcement);
|
||||||
|
|
@ -22,6 +24,8 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
||||||
|
|
||||||
public Task<Announcement> GetAnnouncementDesignFirstAsync();
|
public Task<Announcement> GetAnnouncementDesignFirstAsync();
|
||||||
|
|
||||||
public Task<Announcement> GetAnnouncementByIdAsync(int id);
|
public Task<Announcement> GetAnnouncementByIdAsync(int Id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue