This commit is contained in:
Adam 2024-06-30 15:49:50 +02:00
commit 4b2dbfb6ef
6 changed files with 155 additions and 121 deletions

View File

@ -251,7 +251,7 @@ namespace TIAM.Database.Test
product.Price = 30000; product.Price = 30000;
product.UserProductMappings[0].Permissions = 2; product.UserProductMappings[0].Permissions = 2;
Assert.IsTrue(await Dal.UpdateProductAsync(product)); Assert.IsNotNull(await Dal.UpdateProductAsync(product));
product = await Dal.GetProductByIdAsync(productId); product = await Dal.GetProductByIdAsync(productId);

View File

@ -63,41 +63,42 @@ namespace TIAM.Database.DataLayers.Admins
public Task<bool> AddTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.AddTransfer(transfer)); public Task<bool> AddTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.AddTransfer(transfer));
public async Task<Transfer?> UpdateTransferAsync(Transfer transfer) public Task<Transfer?> UpdateTransferAsync(Transfer transfer) => UpdateSafeAsync(transfer, (ctx, safeTransfer) => ctx.UpdateTransfer(safeTransfer));
{ //public async Task<Transfer?> UpdateTransferAsync(Transfer transfer)
Transfer? entity = null; //{
// Transfer? entity = null;
var result = await TransactionAsync(ctx => // var result = await TransactionAsync(ctx =>
{ // {
entity = ctx.Set<Transfer>().AsNoTracking().FirstOrDefault(e => e.Id == transfer.Id); // entity = ctx.Set<Transfer>().AsNoTracking().FirstOrDefault(e => e.Id == transfer.Id);
if (entity == null) return false; // if (entity == null) return false;
ctx.Entry(entity).State = EntityState.Detached; // ctx.Entry(entity).State = EntityState.Detached;
ctx.Entry(entity).CurrentValues.SetValues(transfer); // ctx.Entry(entity).CurrentValues.SetValues(transfer);
return ctx.UpdateTransfer(entity); // return ctx.UpdateTransfer(entity);
//foreach (var entityEntry in ctx.ChangeTracker.Entries()) // //foreach (var entityEntry in ctx.ChangeTracker.Entries())
//{ // //{
// if (entityEntry.Entity is not Transfer) // // if (entityEntry.Entity is not Transfer)
// entityEntry.State = EntityState.Unchanged; // // entityEntry.State = EntityState.Unchanged;
//} // //}
//var existingTransfer = ctx.Transfers.Local.SingleOrDefault(o => o.Id == transfer.Id); // //var existingTransfer = ctx.Transfers.Local.SingleOrDefault(o => o.Id == transfer.Id);
//if (existingTransfer != null) // //if (existingTransfer != null)
// ctx.Entry(existingTransfer).State = EntityState.Detached; // // ctx.Entry(existingTransfer).State = EntityState.Detached;
//var existingUsers = ctx.Users.Local.Where(o => transfer.TransferToDrivers.Any(x => x.UserProductMapping.UserId == o.Id)).ToList(); // //var existingUsers = ctx.Users.Local.Where(o => transfer.TransferToDrivers.Any(x => x.UserProductMapping.UserId == o.Id)).ToList();
//foreach (var existingUser in existingUsers) // //foreach (var existingUser in existingUsers)
// ctx.Entry(existingUser).State = EntityState.Detached; // // ctx.Entry(existingUser).State = EntityState.Detached;
//transfer.TransferToDrivers = null!; // //transfer.TransferToDrivers = null!;
//return ctx.UpdateTransfer(transfer);
});
return result ? entity : null; // //return ctx.UpdateTransfer(transfer);
} // });
// return result ? entity : null;
//}
public Task<bool> UpdateTransferAsync(Transfer transfer, TransferToDriver transferToDriver) => UpdateTransferAsync(transfer, [transferToDriver]); public Task<bool> UpdateTransferAsync(Transfer transfer, TransferToDriver transferToDriver) => UpdateTransferAsync(transfer, [transferToDriver]);
public Task<bool> UpdateTransferAsync(Transfer transfer, List<TransferToDriver> transferToDrivers) public Task<bool> UpdateTransferAsync(Transfer transfer, List<TransferToDriver> transferToDrivers)
@ -130,25 +131,28 @@ namespace TIAM.Database.DataLayers.Admins
public Task<List<TransferToDriver>> GetTransferToDriversByTransferIdAsync(Guid transferId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetTransferToDriversByTransferId(transferId, autoInclude).ToList()); public Task<List<TransferToDriver>> GetTransferToDriversByTransferIdAsync(Guid transferId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetTransferToDriversByTransferId(transferId, autoInclude).ToList());
public Task<bool> AddTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.AddTransferToDriver(transferToDriver)); public Task<bool> AddTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.AddTransferToDriver(transferToDriver));
public async Task<TransferToDriver?> UpdateTransferToDriverAsync(TransferToDriver transferToDriver)
{
var transferToDriverId = transferToDriver.Id;
TransferToDriver transferToDriver2 = null!;
var result = await TransactionAsync(ctx => public Task<TransferToDriver?> UpdateTransferToDriverAsync(TransferToDriver transferToDriver)
{ => UpdateSafeAsync(transferToDriver, (ctx, safeTransferToDriver) => ctx.UpdateTransferToDriver(safeTransferToDriver));
transferToDriver2 = ctx.TransferToDrivers.FirstOrDefault(x => x.Id == transferToDriverId)!; //public async Task<TransferToDriver?> UpdateTransferToDriverAsync(TransferToDriver transferToDriver)
transferToDriver2.CarId = transferToDriver.CarId; //{
transferToDriver2.LicencePlate = transferToDriver.LicencePlate; // var transferToDriverId = transferToDriver.Id;
transferToDriver2.UserProductMappingId = transferToDriver.UserProductMappingId; // TransferToDriver transferToDriver2 = null!;
transferToDriver2.TransferId = transferToDriver.TransferId;
transferToDriver2.Price = transferToDriver.Price;
return ctx.TransferToDrivers.Update(transferToDriver2).State == EntityState.Modified; // var result = await TransactionAsync(ctx =>
}); // {
// transferToDriver2 = ctx.TransferToDrivers.FirstOrDefault(x => x.Id == transferToDriverId)!;
// transferToDriver2.CarId = transferToDriver.CarId;
// transferToDriver2.LicencePlate = transferToDriver.LicencePlate;
// transferToDriver2.UserProductMappingId = transferToDriver.UserProductMappingId;
// transferToDriver2.TransferId = transferToDriver.TransferId;
// transferToDriver2.Price = transferToDriver.Price;
return result ? transferToDriver2 : null; // return ctx.TransferToDrivers.Update(transferToDriver2).State == EntityState.Modified;
} // });
// return result ? transferToDriver2 : null;
//}
public Task<bool> RemoveTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.RemoveTransferToDriver(transferToDriver.Id)); public Task<bool> RemoveTransferToDriverAsync(TransferToDriver transferToDriver) => TransactionAsync(ctx => ctx.RemoveTransferToDriver(transferToDriver.Id));
#endregion TransferToDriver #endregion TransferToDriver
@ -203,7 +207,7 @@ namespace TIAM.Database.DataLayers.Admins
public string GetProductsJsonByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByCompanyId(serviceProviderId, includeUsers).ToJson()); public string GetProductsJsonByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByCompanyId(serviceProviderId, includeUsers).ToJson());
public Task<bool> AddProductAsync(Product product) => TransactionAsync(ctx => ctx.AddProduct(product)); public Task<bool> AddProductAsync(Product product) => TransactionAsync(ctx => ctx.AddProduct(product));
public Task<bool> UpdateProductAsync(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product)); public Task<Product?> UpdateProductAsync(Product product) => UpdateSafeAsync(product, (ctx, safeProduct) => ctx.UpdateProduct(safeProduct));
public Task<bool> RemoveProductAsync(Product product) => RemoveProductAsync(product.Id); public Task<bool> RemoveProductAsync(Product product) => RemoveProductAsync(product.Id);
public Task<bool> RemoveProductAsync(Guid productId) => TransactionAsync(ctx => ctx.RemoveProduct(productId)); public Task<bool> RemoveProductAsync(Guid productId) => TransactionAsync(ctx => ctx.RemoveProduct(productId));

View File

@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using TIAM.Core.Enums;
using TIAM.Entities.Transfers; using TIAM.Entities.Transfers;
namespace TIAM.Database.DbSets.Transfers; namespace TIAM.Database.DbSets.Transfers;
@ -13,6 +14,20 @@ public static class TransferDbSetExtensions
public static bool UpdateTransfer(this ITransferDbSet ctx, Transfer transfer) public static bool UpdateTransfer(this ITransferDbSet ctx, Transfer transfer)
=> ctx.Transfers.Update(transfer).State == EntityState.Modified; => ctx.Transfers.Update(transfer).State == EntityState.Modified;
public static bool UpdateTransferStatus(this ITransferDbSet ctx, Guid transferId, TransferStatusType transferStatusType)
{
var transfer = ctx.Transfers.FirstOrDefault(x => x.Id == transferId);
return transfer != null && ctx.UpdateTransferStatus(transfer, transferStatusType);
}
public static bool UpdateTransferStatus(this ITransferDbSet ctx, Transfer transfer, TransferStatusType transferStatusType)
{
if (transfer.TransferStatusType == transferStatusType) return true;
transfer.TransferStatusType = transferStatusType;
return ctx.Transfers.Update(transfer).State == EntityState.Modified;
}
private static bool RemoveTransfer(this ITransferDbSet ctx, Transfer transfer) private static bool RemoveTransfer(this ITransferDbSet ctx, Transfer transfer)
{ {
ctx.TransferToDrivers.RemoveRange(ctx.TransferToDrivers.Where(x => x.TransferId == transfer.Id)); ctx.TransferToDrivers.RemoveRange(ctx.TransferToDrivers.Where(x => x.TransferId == transfer.Id));

View File

@ -18,12 +18,18 @@ public static class TransferToDriverDbSetExtensions
public static bool AddTransferToDriver(this ITransferDbSet ctx, TransferToDriver transferToDriver) public static bool AddTransferToDriver(this ITransferDbSet ctx, TransferToDriver transferToDriver)
{ {
var transfer = ctx.GetTransferById(transferToDriver.TransferId)!; ctx.UpdateTransferStatus(transferToDriver.TransferId, TransferStatusType.AssignedToDriver);
transfer.TransferStatusType = TransferStatusType.AssignedToDriver;
return ctx.TransferToDrivers.Add(transferToDriver).State == EntityState.Added; return ctx.TransferToDrivers.Add(transferToDriver).State == EntityState.Added;
} }
public static bool UpdateTransferToDriver(this ITransferDbSet ctx, TransferToDriver transferToDriver)
{
ctx.UpdateTransferStatus(transferToDriver.Transfer, TransferStatusType.AssignedToDriver);
return ctx.TransferToDrivers.Update(transferToDriver).State == EntityState.Modified;
}
private static bool RemoveTransferToDriver(this ITransferDbSet ctx, TransferToDriver transferToDriver) private static bool RemoveTransferToDriver(this ITransferDbSet ctx, TransferToDriver transferToDriver)
{ {
//TODO: TransferStatusType change, ha nincs sofőr a törlés után! - J. //TODO: TransferStatusType change, ha nincs sofőr a törlés után! - J.

View File

@ -80,56 +80,58 @@
</div> </div>
<TransferGrid @ref="_gridTransfer" <TransferGrid @ref="_gridTransfer"
Logger="_logger" Logger="_logger"
SignalRClient="AdminSignalRClient" SignalRClient="AdminSignalRClient"
FilterText="@_filterText" FilterText="@_filterText"
OnDataSourceChanged="DataSourceChanged" OnDataSourceChanged="DataSourceChanged"
OnGridItemChanging="DataSourceItemChanging" OnGridItemChanging="DataSourceItemChanging"
OnGridItemChanged="DataSourceItemChanged" OnGridItemChanged="DataSourceItemChanged"
OnGridItemDeleting="DataItemDeleting" OnGridItemDeleting="DataItemDeleting"
OnGridEditModelSaving="DataItemSaving" OnGridEditModelSaving="DataItemSaving"
CustomizeElement="Grid_CustomizeElement"
CustomizeElement="Grid_CustomizeElement" CustomizeEditModel="Grid_CustomizeEditModel"
CustomizeEditModel="Grid_CustomizeEditModel" EditMode="GridEditMode.EditForm"
EditMode="GridEditMode.EditForm" ColumnResizeMode="GridColumnResizeMode.NextColumn"
ColumnResizeMode="GridColumnResizeMode.NextColumn" AllowSelectRowByClick="false"
AllowSelectRowByClick="false" PageSize="13"
PageSize="13" ShowFilterRow="true">
ShowFilterRow="true">
<Columns> <Columns>
<DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" /> <DxGridCommandColumn NewButtonVisible="false" DeleteButtonVisible="AcDomain.IsDeveloperVersion" Width="80" MinWidth="80" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N"/> <DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
<DxGridDataColumn FieldName="OrderId" SortIndex="1" SortOrder="GridColumnSortOrder.Descending"> <DxGridDataColumn FieldName="OrderId" Caption="Order" SortIndex="1" SortOrder="GridColumnSortOrder.Descending" Width="70">
<CellDisplayTemplate> <CellDisplayTemplate>
@{ @{
var idKeyField = ((Transfer)context.DataItem).Id; var idKeyField = ((Transfer)context.DataItem).Id.ToString("N");
var editUri = $"mytransfers/{idKeyField:N}"; var editUri = $"mytransfers/{idKeyField}";
<NavLink href="@editUri"> <NavLink href="@editUri">
<text>@context.Value</text> <text>@context.Value</text>
</NavLink> </NavLink>
} }
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="FromAddress"/> <DxGridDataColumn FieldName="FromAddress" />
<DxGridDataColumn FieldName="ToAddress"/> <DxGridDataColumn FieldName="ToAddress" />
<DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="140" /> <DxGridDataColumn FieldName="Appointment" DisplayFormat="g" Width="125" />
<DxGridDataColumn FieldName="FullName"/> <DxGridDataColumn FieldName="PassengerCount" Caption="Passengers" Width="90" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="ContactPhone"/> <DxGridDataColumn FieldName="LuggageCount" Caption="Luggages" Width="80" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="ContactEmail"> <DxGridDataColumn FieldName="FlightNumber" Caption="FlightNum" Width="95" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="Price" Caption="Price" Width="70" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn FieldName="FullName" />
<DxGridDataColumn FieldName="ContactPhone" Width="120" />
<DxGridDataColumn FieldName="ContactEmail" Width="120">
<CellDisplayTemplate> <CellDisplayTemplate>
@{ @{
var keyField = context.Value; var keyField = context.Value;
var keyItem = (Transfer)context.DataItem; var keyItem = (Transfer)context.DataItem;
string buttonText = "Contact"; string buttonText = "Contact";
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary"/> <DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
} }
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="PassengerCount"/> <DxGridDataColumn FieldName="PaymentId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn FieldName="PaymentId" DisplayFormat="N" /> <DxGridDataColumn Caption="Paid" FieldName="Paid" Width="75" TextAlignment="GridTextAlignment.Center" CaptionAlignment="GridTextAlignment.Center" />
<DxGridDataColumn Caption="Paid" FieldName="Paid" /> <DxGridDataColumn FieldName="TransferStatusType" Caption="Status" SortIndex="0" Width="120" SortOrder="GridColumnSortOrder.Ascending" SortMode="GridColumnSortMode.Value">
<DxGridDataColumn FieldName="TransferStatusType" SortIndex="0" SortOrder="GridColumnSortOrder.Ascending" SortMode="GridColumnSortMode.Value">
<CellDisplayTemplate> <CellDisplayTemplate>
@{ @{
@ -139,12 +141,14 @@
} }
</CellDisplayTemplate> </CellDisplayTemplate>
</DxGridDataColumn> </DxGridDataColumn>
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" /> <DxGridDataColumn FieldName="ReferralId" DisplayFormat="N" Visible="false" />
<DxGridDataColumn FieldName="Comment" Caption="Comment" />
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="125" CaptionAlignment="GridTextAlignment.Center" TextAlignment="GridTextAlignment.Center" />
</Columns> </Columns>
<DetailRowTemplate> <DetailRowTemplate>
<DxTabs> <DxTabs>
<DxTabPage Text="Messages"> <DxTabPage Text="Messages">
<MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" /> <MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" />
</DxTabPage> </DxTabPage>
<DxTabPage Text="Driver"> <DxTabPage Text="Driver">
<TransferToDriverGridComponent ContextId="((Transfer)context.DataItem).Id" ParentData="(Transfer)context.DataItem" /> <TransferToDriverGridComponent ContextId="((Transfer)context.DataItem).Id" ParentData="(Transfer)context.DataItem" />
@ -236,31 +240,31 @@
private bool _popupVisible; private bool _popupVisible;
private TransferGrid _gridTransfer; private TransferGrid _gridTransfer;
private DxTagBox<TransferStatusModel, TransferStatusModel> _filterTag; private DxTagBox<TransferStatusModel, TransferStatusModel> _filterTag;
public List<string> IgnoreList = public List<string> IgnoreList =
[ [
"ReceiverEmailAddress", "ReceiverEmailAddress",
"ReceiverFullName", "ReceiverFullName",
"ReceiverId", "ReceiverId",
"SenderEmailAddress", "SenderEmailAddress",
"SenderFullName", "SenderFullName",
"SenderId", "SenderId",
"ContextId", "ContextId",
]; ];
private static List<TransferStatusModel> Statuses = private static List<TransferStatusModel> Statuses =
[ [
new(Convert.ToByte(TransferStatusType.OrderSubmitted), "Order submitted"), new(Convert.ToByte(TransferStatusType.OrderSubmitted), "Order submitted"),
new(Convert.ToByte(TransferStatusType.OrderConfirmed), "Order confirmed"), new(Convert.ToByte(TransferStatusType.OrderConfirmed), "Order confirmed"),
new(Convert.ToByte(TransferStatusType.AssignedToDriver), "Assigned to driver"), new(Convert.ToByte(TransferStatusType.AssignedToDriver), "Assigned to driver"),
new(Convert.ToByte(TransferStatusType.DriverConfirmed), "Driver confirmed"), new(Convert.ToByte(TransferStatusType.DriverConfirmed), "Driver confirmed"),
new(Convert.ToByte(TransferStatusType.DriverEnRoute), "Driver enroute"), new(Convert.ToByte(TransferStatusType.DriverEnRoute), "Driver enroute"),
new(Convert.ToByte(TransferStatusType.PassengerPickup), "Passenger in car"), new(Convert.ToByte(TransferStatusType.PassengerPickup), "Passenger in car"),
new(Convert.ToByte(TransferStatusType.Finished), "Finished"), new(Convert.ToByte(TransferStatusType.Finished), "Finished"),
new(Convert.ToByte(TransferStatusType.UserCanceled), "User cancelled"), new(Convert.ToByte(TransferStatusType.UserCanceled), "User cancelled"),
new(Convert.ToByte(TransferStatusType.AdminDenied), "Admin cancelled") new(Convert.ToByte(TransferStatusType.AdminDenied), "Admin cancelled")
]; ];
private static List<TransferStatusModel> _selectedCategories = Statuses.Where(x => /* x.StatusValue != (byte)TransferStatusType.OrderSubmitted && */ x.StatusValue != (byte)TransferStatusType.Finished && x.StatusValue != (byte)TransferStatusType.UserCanceled && x.StatusValue != (byte)TransferStatusType.AdminDenied).ToList(); private static List<TransferStatusModel> _selectedCategories = Statuses.Where(x => /* x.StatusValue != (byte)TransferStatusType.OrderSubmitted && */ x.StatusValue != (byte)TransferStatusType.Finished && x.StatusValue != (byte)TransferStatusType.UserCanceled && x.StatusValue != (byte)TransferStatusType.AdminDenied).ToList();
@ -396,7 +400,7 @@
_filterText = filterText; _filterText = filterText;
_gridTransfer.SetFieldFilterCriteria("TransferStatusType", filterCriteria); _gridTransfer.SetFieldFilterCriteria("TransferStatusType", filterCriteria);
} }
private void DataSourceChanged(IList<Transfer> transfers) private void DataSourceChanged(IList<Transfer> transfers)
{ {
_logger.Info("DataSourceChanged called"); _logger.Info("DataSourceChanged called");
@ -408,7 +412,7 @@
// if(!SelectedCategories.Any()) // if(!SelectedCategories.Any())
// SelectedCategories = [Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!]; // SelectedCategories = [Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!];
// var filterTransferStatusType = Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!; // var filterTransferStatusType = Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!;
// if (SelectedCategories.All(x => x.StatusValue != filterTransferStatusType.StatusValue)) // if (SelectedCategories.All(x => x.StatusValue != filterTransferStatusType.StatusValue))
@ -462,23 +466,23 @@
} }
_dataStorage = new DxSchedulerDataStorage _dataStorage = new DxSchedulerDataStorage
{
AppointmentMappings = new DxSchedulerAppointmentMappings()
{ {
Type = "AppointmentType", AppointmentMappings = new DxSchedulerAppointmentMappings()
Start = "StartDate", {
End = "EndDate", Type = "AppointmentType",
Subject = "Caption", Start = "StartDate",
AllDay = "AllDay", End = "EndDate",
Location = "Location", Subject = "Caption",
Description = "Description", AllDay = "AllDay",
LabelId = "Label", Location = "Location",
StatusId = "Status", Description = "Description",
RecurrenceInfo = "Recurrence" LabelId = "Label",
}, StatusId = "Status",
RecurrenceInfo = "Recurrence"
},
AppointmentsSource = AppointmentModels AppointmentsSource = AppointmentModels
}; };
} }
public AppointmentModel CreateAppointmentModel(Transfer transfer) public AppointmentModel CreateAppointmentModel(Transfer transfer)

View File

@ -304,6 +304,7 @@ namespace TIAMWebApp.Server.Controllers
//[AllowAnonymous] //[AllowAnonymous]
//[HttpGet] //[HttpGet]
//[Route(APIUrls.GetAllCarsRouteName)] //[Route(APIUrls.GetAllCarsRouteName)]
[NonAction]
[SignalR(SignalRTags.GetAllCarsByProductId)] [SignalR(SignalRTags.GetAllCarsByProductId)]
public async Task<List<Car>> GetAllCarsByProductId(Guid productId) public async Task<List<Car>> GetAllCarsByProductId(Guid productId)
{ {
@ -394,18 +395,22 @@ namespace TIAMWebApp.Server.Controllers
//[HttpPost] //[HttpPost]
//[Route(APIUrls.AddProductRouteName)] //[Route(APIUrls.AddProductRouteName)]
//[Tags("In-Progress", "Product")] //[Tags("In-Progress", "Product")]
[NonAction]
[SignalR(SignalRTags.UpdateProduct)] [SignalR(SignalRTags.UpdateProduct)]
public async Task<Product> UpdateProduct([FromBody] Product product) public async Task<Product?> UpdateProduct([FromBody] Product product)
{ {
_logger.Info(@"UpdateProduct called"); _logger.Info(@"UpdateProduct called");
var result = await adminDal.UpdateProductAsync(product); return await adminDal.UpdateProductAsync(product);
return product; ;
//var result = await adminDal.UpdateProductAsync(product);
//return product;
} }
//[HttpPost] //[HttpPost]
//[Route(APIUrls.AddProductRouteName)] //[Route(APIUrls.AddProductRouteName)]
//[Tags("In-Progress", "Product")] //[Tags("In-Progress", "Product")]
[NonAction]
[SignalR(SignalRTags.RemoveProduct)] [SignalR(SignalRTags.RemoveProduct)]
public async Task<Product> RemoveProduct([FromBody] Product product) public async Task<Product> RemoveProduct([FromBody] Product product)
{ {