RestApi fix v1.0
This commit is contained in:
parent
7d1cc0916a
commit
95aca7fd0f
@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EntityFramework" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.12" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.1">
|
||||
|
@ -28,9 +28,10 @@ namespace AutoRepairShopDatabaseImplement.Implements
|
||||
public ManagerViewModel? GetElement(ManagerSearchModel model)
|
||||
{
|
||||
using var context = new AutoRepairShopDatabase();
|
||||
var manager = context.Managers.FirstOrDefault(x =>
|
||||
x.Login.Equals(model.Login, StringComparison.OrdinalIgnoreCase));
|
||||
return manager != null ? manager.GetViewModel : null;
|
||||
return context.Managers.FirstOrDefault(x =>
|
||||
(!string.IsNullOrEmpty(model.Login) && x.Login == model.Login) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
public List<ManagerViewModel> GetFilteredList(ManagerSearchModel model)
|
||||
{
|
||||
|
@ -37,5 +37,17 @@ namespace AutoRepairShopRestApi.Controllers
|
||||
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public void AddWork(WorkBindingModel workModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
_work.AddWork(workModel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error adding work");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace AutoRepairShopRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
[HttpPost("register")]
|
||||
public void Register(ManagerBindingModel model)
|
||||
{
|
||||
try
|
||||
@ -49,7 +49,7 @@ namespace AutoRepairShopRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
[HttpPost("update")]
|
||||
public void UpdateData(ManagerBindingModel model)
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user