Compare commits
6 Commits
83be60e4d2
...
8577d26812
| Author | SHA1 | Date |
|---|---|---|
|
|
8577d26812 | |
|
|
b822711be7 | |
|
|
d51888b8a3 | |
|
|
357858c28f | |
|
|
2ba5bbd01a | |
|
|
2a76051a4e |
|
|
@ -77,8 +77,12 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Areas.Admin.Controllers
|
||||||
Message = viewModel.Body,
|
Message = viewModel.Body,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var jsonMessage = JsonConvert.SerializeObject(announcement, Formatting.Indented,
|
|
||||||
new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() });
|
var jsonMessage = JsonConvert.SerializeObject(announcement, Formatting.Indented, new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
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 IAuctionService _auctionService;
|
private readonly AuctionService _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, IAuctionService auctionService)
|
public AuctionPluginAdminController(ILocalizationService localizationService, INotificationService notificationService, ISettingService settingService, AuctionSettings auctionSettings, ILogger logger, AuctionService auctionService)
|
||||||
{
|
{
|
||||||
_localizationService = localizationService;
|
_localizationService = localizationService;
|
||||||
_notificationService = notificationService;
|
_notificationService = notificationService;
|
||||||
|
|
@ -148,7 +148,9 @@ public class AuctionPluginAdminController : BasePluginController
|
||||||
var model = new TestPageViewModel();
|
var model = new TestPageViewModel();
|
||||||
|
|
||||||
var auctions = await _auctionService.GetAllAuctionsAsync();
|
var auctions = await _auctionService.GetAllAuctionsAsync();
|
||||||
model.Message = $"Teszt üzenet; Auctions count: {auctions.Count}";
|
var auctionDtoWithProducts = await _auctionService.GetAuctionDtoWithProductByIdAsync(1, 4);
|
||||||
|
|
||||||
|
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 IAuctionService _auctionService;
|
protected readonly AuctionService _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(IAuctionService auctionService, ILogger logger, IProductService productService, MyProductModelFactory productModelFactory)
|
public AuctionController(AuctionService auctionService, ILogger logger, IProductService productService, MyProductModelFactory productModelFactory)
|
||||||
{
|
{
|
||||||
_auctionService = auctionService;
|
_auctionService = auctionService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,31 @@
|
||||||
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>, IAuctionBidDbSet<AuctionBidDbTable>
|
public class AuctionDbContext : MgDbContextBase, IAuctionDbSet<AuctionDbTable>, IProductToAuctionDbSet<ProductToAuctionDbTable>, 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, AuctionBidDbTable auctionBidDbTable) : base(dataProvider)
|
public AuctionDbContext(INopDataProvider dataProvider, AuctionDbTable auctionDbTable, ProductToAuctionDbTable productToAuctionDbTable, 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;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer.Interfaces;
|
||||||
|
|
||||||
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;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.DataLayer.Interfaces;
|
||||||
|
|
||||||
public interface IAuctionDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<Auction>
|
public interface IAuctionDbSet<TDbTable> : IMgDbTableBase where TDbTable : IRepository<Auction>
|
||||||
{
|
{
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
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>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
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,18 +1,19 @@
|
||||||
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, ITimeStampInfo//, ISoftRemoveEntityInt
|
public partial class Auction: MgEntityBase, IAuction
|
||||||
{
|
{
|
||||||
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; }
|
||||||
|
|
@ -20,10 +21,6 @@ public partial class Auction: MgEntityBase, ITimeStampInfo//, ISoftRemoveEntityI
|
||||||
|
|
||||||
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,11 +1,12 @@
|
||||||
using AyCode.Interfaces.Entities;
|
using AyCode.Interfaces.Entities;
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
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;
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
namespace Nop.Plugin.Misc.AuctionPlugin.Domains.Entities
|
||||||
{
|
{
|
||||||
public partial class AuctionBid : MgEntityBase, ITimeStampInfo//, ISoftRemoveEntityInt
|
public partial class AuctionBid : MgEntityBase, IAuctionBid
|
||||||
{
|
{
|
||||||
public int ProductAuctionMappingId { get; set; }
|
public int ProductAuctionMappingId { get; set; }
|
||||||
|
|
||||||
|
|
@ -16,8 +17,7 @@ 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; }
|
||||||
|
|
||||||
public DateTime CreateDate { get; set; }
|
[SkipValuesOnUpdate]
|
||||||
|
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
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;
|
||||||
|
|
||||||
|
|
@ -7,6 +8,7 @@ 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; }
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
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,23 +1,28 @@
|
||||||
using AyCode.Interfaces.Entities;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using AyCode.Interfaces.TimeStampInfo;
|
using AyCode.Interfaces.Entities;
|
||||||
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, ITimeStampInfo//, ISoftRemoveEntityInt
|
public partial class ProductToAuctionMapping : MgEntityBase, IProductToAuctionMapping
|
||||||
{
|
{
|
||||||
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; } = AuctionStatus.None;
|
public AuctionStatus AuctionStatus { get; set; }
|
||||||
|
|
||||||
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,4 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Builder;
|
using AyCode.Core.Extensions;
|
||||||
|
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;
|
||||||
|
|
@ -6,6 +7,8 @@ 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;
|
||||||
|
|
@ -16,7 +19,6 @@ 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;
|
||||||
|
|
||||||
|
|
@ -52,15 +54,16 @@ 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<IAuctionService, AuctionService>();
|
services.AddScoped<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>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +72,11 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Infrastructure
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <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 =>
|
||||||
{
|
{
|
||||||
|
|
@ -79,5 +86,6 @@ 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,9 +23,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Services
|
||||||
|
|
||||||
public AnnouncementService(IRepository<Announcement> announcementRepository)
|
public AnnouncementService(IRepository<Announcement> announcementRepository)
|
||||||
{
|
{
|
||||||
|
|
||||||
_announcementRepository = announcementRepository;
|
_announcementRepository = announcementRepository;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -34,86 +32,56 @@ 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();
|
||||||
|
|
||||||
var query = from c in _announcementRepository.Table
|
return new PagedList<Announcement>(announcements, pageIndex, pageSize);
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
{
|
{
|
||||||
var result = await _announcementRepository.GetAllAsync(query =>
|
return await _announcementRepository.Table.FirstOrDefaultAsync(announcement => announcement.IsActive == true);
|
||||||
{
|
|
||||||
query = query.Where(record => record.IsActive == true);
|
|
||||||
return query;
|
|
||||||
});
|
|
||||||
|
|
||||||
//var query = from c in _announcementRepository.Table
|
//var result = await _announcementRepository.GetAllAsync(announcements => announcements.Where(record => record.IsActive == true));
|
||||||
|
|
||||||
// where c.IsActive == true
|
////var query = from c in _announcementRepository.Table
|
||||||
|
|
||||||
// orderby c.CreateDate descending
|
//// where c.IsActive == true
|
||||||
|
|
||||||
// select c;
|
//// orderby c.CreateDate descending
|
||||||
|
|
||||||
var LatestAnnouncement = result.ToList().FirstOrDefault();
|
//// select c;
|
||||||
|
|
||||||
return LatestAnnouncement;
|
//var LatestAnnouncement = result.ToList().FirstOrDefault();
|
||||||
|
|
||||||
|
//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,6 +4,7 @@ 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;
|
||||||
|
|
@ -42,7 +43,7 @@ public class AuctionService : IAuctionService
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ctor
|
/// Ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="customerBidRepository">Store pickup point repository</param>
|
/// <param name="ctx"></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)
|
||||||
|
|
@ -63,8 +64,6 @@ 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;
|
||||||
|
|
@ -146,7 +145,32 @@ 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);
|
||||||
|
|
@ -163,7 +187,5 @@ public class AuctionService : IAuctionService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Dtos
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +1,9 @@
|
||||||
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;
|
namespace Nop.Plugin.Misc.AuctionPlugin.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents plugin event consumer
|
/// Represents plugin event consumer
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,7 @@ 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);
|
||||||
|
|
@ -24,8 +22,6 @@ 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