fix
This commit is contained in:
parent
d81f2cf847
commit
29481698ab
@ -2,6 +2,7 @@
|
||||
using CarRentContracts.BindingModels;
|
||||
using CarRentContracts.BusinessLogicContracts;
|
||||
using CarRentContracts.SearchModels;
|
||||
using CarRentContracts.ViewModels;
|
||||
using ClientRentBusinessLogic.BusinessLogics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -146,7 +147,16 @@ namespace CarRent
|
||||
{
|
||||
try
|
||||
{
|
||||
var view = _carLogic.ReadElement(new CarSearchModel { Id = _id.Value });
|
||||
CarViewModel? view;
|
||||
if (Program.CURRENT_DATABASE.Equals("PostgreSQL"))
|
||||
{
|
||||
view = _carLogic.ReadElement(new CarSearchModel { Id = _id });
|
||||
}
|
||||
else
|
||||
{
|
||||
view = _carLogic.ReadElement(new CarSearchModel { ObjectId = _objectId });
|
||||
}
|
||||
|
||||
|
||||
if (view != null)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ namespace CarRentMongoDB.Implements
|
||||
{
|
||||
using var context = new CarRentMongoDB();
|
||||
var cars = context.GetCollection<Car>("Cars");
|
||||
var filter = Builders<Car>.Filter.Eq(x => x.Id, model.Id);
|
||||
var filter = Builders<Car>.Filter.Eq(x => x.ObjectId, model.ObjectId);
|
||||
var component = cars.Find(filter).FirstOrDefault();
|
||||
if (component == null)
|
||||
{
|
||||
@ -150,7 +150,7 @@ namespace CarRentMongoDB.Implements
|
||||
{
|
||||
using var context = new CarRentMongoDB();
|
||||
var cars = context.GetCollection<Car>("Cars");
|
||||
var filter = Builders<Car>.Filter.Eq(x => x.Id, model.Id);
|
||||
var filter = Builders<Car>.Filter.Eq(x => x.ObjectId, model.ObjectId);
|
||||
var element = cars.Find(filter).FirstOrDefault();
|
||||
if (element != null)
|
||||
{
|
||||
|
@ -83,6 +83,7 @@ namespace CarRentMongoDB.Models
|
||||
Color = model.Color;
|
||||
LicensePlate = model.LicensePlate;
|
||||
RentalCostPerHour = model.RentalCostPerHour;
|
||||
BranchStringId = model.BranchStringId;
|
||||
}
|
||||
|
||||
public CarViewModel GetViewModel => new()
|
||||
|
Loading…
Reference in New Issue
Block a user