diff --git a/.vs/ReCapProject/DesignTimeBuild/.dtbcache.v2 b/.vs/ReCapProject/DesignTimeBuild/.dtbcache.v2 index 582c87d..a51480e 100644 Binary files a/.vs/ReCapProject/DesignTimeBuild/.dtbcache.v2 and b/.vs/ReCapProject/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/ReCapProject/v16/.suo b/.vs/ReCapProject/v16/.suo index 22bb5f5..dd3461c 100644 Binary files a/.vs/ReCapProject/v16/.suo and b/.vs/ReCapProject/v16/.suo differ diff --git a/Business/Abstract/ICustomerService.cs b/Business/Abstract/ICustomerService.cs new file mode 100644 index 0000000..6e6fd62 --- /dev/null +++ b/Business/Abstract/ICustomerService.cs @@ -0,0 +1,17 @@ +using Core.Utilities.Results; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Business.Abstract +{ + public interface ICustomerService + { + IResult Add(Customer customer); + IResult Delete(Customer customer); + IResult Update(Customer customer); + IDataResult> GetAll(); + IDataResult GetById(int id); + } +} diff --git a/Business/Abstract/IRentalService.cs b/Business/Abstract/IRentalService.cs new file mode 100644 index 0000000..9ba1e61 --- /dev/null +++ b/Business/Abstract/IRentalService.cs @@ -0,0 +1,17 @@ +using Core.Utilities.Results; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Business.Abstract +{ + public interface IRentalService + { + IResult Add(Rental rental); + IResult Delete(Rental rental); + IResult Update(Rental rental); + IDataResult> GetAll(); + IDataResult GetById(int id); + } +} diff --git a/Business/Abstract/IUserService.cs b/Business/Abstract/IUserService.cs new file mode 100644 index 0000000..21e4147 --- /dev/null +++ b/Business/Abstract/IUserService.cs @@ -0,0 +1,17 @@ +using Core.Utilities.Results; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Business.Abstract +{ + public interface IUserService + { + IResult Add(User user); + IResult Delete(User user); + IResult Update(User user); + IDataResult> GetAll(); + IDataResult GetById(int id); + } +} diff --git a/Business/Concrete/CarManager.cs b/Business/Concrete/CarManager.cs index 97abba6..c0529bc 100644 --- a/Business/Concrete/CarManager.cs +++ b/Business/Concrete/CarManager.cs @@ -54,7 +54,7 @@ public IDataResult> GetAll() public IDataResult GetById(int id) { return new SuccessDataResult - (_carDal.Get(c => c.Id == id)); + (_carDal.Get(c => c.CarId == id)); } public IDataResult> GetCarDetails() diff --git a/Business/Concrete/CustomerManager.cs b/Business/Concrete/CustomerManager.cs new file mode 100644 index 0000000..251951e --- /dev/null +++ b/Business/Concrete/CustomerManager.cs @@ -0,0 +1,50 @@ +using Business.Abstract; +using Business.Constans; +using Core.Utilities.Results; +using DataAccess.Abstract; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Business.Concrete +{ + public class CustomerManager : ICustomerService + { + ICustomerDal _customerDal; + public CustomerManager(ICustomerDal customerDal) + { + _customerDal = customerDal; + } + + public IResult Add(Customer customer) + { + _customerDal.Add(customer); + return new SuccessResult(Messages.UserAdded); + } + + public IResult Delete(Customer customer) + { + _customerDal.Delete(customer); + return new SuccessResult(Messages.UserDeleted); + } + + public IDataResult> GetAll() + { + return new SuccessDataResult> + (_customerDal.GetAll(), Messages.UsersListed); + } + + public IDataResult GetById(int id) + { + return new SuccessDataResult + (_customerDal.Get(c => c.CustomerId == id)); + } + + public IResult Update(Customer customer) + { + _customerDal.Update(customer); + return new SuccessResult(Messages.UserUpdated); + } + } +} diff --git a/Business/Concrete/RentalManager.cs b/Business/Concrete/RentalManager.cs new file mode 100644 index 0000000..e080021 --- /dev/null +++ b/Business/Concrete/RentalManager.cs @@ -0,0 +1,76 @@ +using Business.Abstract; +using Business.Constans; +using Core.Utilities.BusinessRules; +using Core.Utilities.Results; +using DataAccess.Abstract; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Business.Concrete +{ + public class RentalManager : IRentalService + { + IRentalDal _rentalDal; + public RentalManager(IRentalDal rentalDal) + { + _rentalDal = rentalDal; + } + public IResult Add(Rental rental) + { + IResult result = BusinessRule.Run( + IsCarBeenDelivered(rental.CarId)); + + if (result != null) + { + return result; + } + + _rentalDal.Add(rental); + return new SuccessResult(Messages.RentalAdded); + } + + public IResult Delete(Rental rental) + { + _rentalDal.Delete(rental); + return new SuccessResult(Messages.RentalDeleted); + } + + public IDataResult> GetAll() + { + return new SuccessDataResult> + (_rentalDal.GetAll()); + } + + public IDataResult GetById(int id) + { + return new SuccessDataResult + (_rentalDal.Get(r => r.Id == id)); + } + + public IResult Update(Rental rental) + { + try + { + _rentalDal.Update(rental); + return new SuccessResult(Messages.RentalUpdated); + } + catch (Exception) + { + return new ErrorResult(Messages.RentalUpdateError); + } + } + + // private metotlar + private IResult IsCarBeenDelivered(int id) + { + var result = _rentalDal.Get(r => r.CarId == id && r.ReturnDate == null); + if (result == null) + { + return new SuccessResult(); + } + return new ErrorResult("Araba teslim edilmemiş. Kiralama iptal."); + } + } +} diff --git a/Business/Concrete/UserManager.cs b/Business/Concrete/UserManager.cs new file mode 100644 index 0000000..f8ae5e2 --- /dev/null +++ b/Business/Concrete/UserManager.cs @@ -0,0 +1,48 @@ +using Business.Abstract; +using Business.Constans; +using Core.Utilities.Results; +using DataAccess.Abstract; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Business.Concrete +{ + public class UserManager : IUserService + { + IUserDal _userDal; + public UserManager(IUserDal userDal) + { + _userDal = userDal; + } + public IResult Add(User user) + { + _userDal.Add(user); + return new SuccessResult(Messages.UserAdded); + } + public IResult Delete(User user) + { + _userDal.Delete(user); + return new SuccessResult(Messages.UserDeleted); + } + + public IDataResult> GetAll() + { + return new SuccessDataResult> + (_userDal.GetAll(), Messages.UsersListed); + } + + public IDataResult GetById(int id) + { + return new SuccessDataResult + (_userDal.Get(u => u.Id == id)); + } + + public IResult Update(User user) + { + _userDal.Update(user); + return new SuccessResult(Messages.UserUpdated); + } + } +} diff --git a/Business/Constans/Messages.cs b/Business/Constans/Messages.cs index 40fe540..1c97dad 100644 --- a/Business/Constans/Messages.cs +++ b/Business/Constans/Messages.cs @@ -29,6 +29,18 @@ public static class Messages public static string ColorListed = "Renkler Listelendi"; public static string ColorAddError = "Renk Eklenemedi"; + internal static string UserAdded = "Kullanıcı başarıyla sisteme eklendi."; + internal static string UserDeleted = "Kullanıcı başarıyla sistemden silindi."; + internal static string UsersListed = "Kullanıcı başarıyla listelendi."; + internal static string UserUpdated = "Kullanıcı bilgileri başarıyla güncellendi."; + + internal static string RentalAdded = "Kiralama işlemi başarıyla gerçekleşti."; + internal static string RentalDeleted = "Kiralama işlemi başarıyla silindi."; + internal static string RentalUpdated = "Kiralama işlemi başarıyla güncellendi."; + internal static string RentalUpdateError = "Kiralama Güncellenemedi."; + internal static string RentalsListed = "Kiralamalar başarıyla listelendi."; + internal static string RentalError = "Bu araç şuan kirada."; + public static string MaintenanceTime = "Sistem Şuan Bakımda."; public static string Added = "Eklendi"; public static string Deleted = "Silindi"; @@ -40,5 +52,6 @@ public static class Messages internal static string CarImageUpdated = "Fotoğraf Güncellendi"; internal static string CarImageNotFound = "Fotoğraf Bulunamadı"; internal static string CarImageDeleted = "Fotoğraf Silindi"; + public static string ReturnDateInvalid = "Kiralama başarısız! Araç müsait değil."; } } diff --git a/Business/bin/Debug/netstandard2.0/Business.dll b/Business/bin/Debug/netstandard2.0/Business.dll index 5e258fa..6765a54 100644 Binary files a/Business/bin/Debug/netstandard2.0/Business.dll and b/Business/bin/Debug/netstandard2.0/Business.dll differ diff --git a/Business/bin/Debug/netstandard2.0/Business.pdb b/Business/bin/Debug/netstandard2.0/Business.pdb index 00d31c8..c379085 100644 Binary files a/Business/bin/Debug/netstandard2.0/Business.pdb and b/Business/bin/Debug/netstandard2.0/Business.pdb differ diff --git a/Business/bin/Debug/netstandard2.0/Core.dll b/Business/bin/Debug/netstandard2.0/Core.dll index 08f27c6..5254373 100644 Binary files a/Business/bin/Debug/netstandard2.0/Core.dll and b/Business/bin/Debug/netstandard2.0/Core.dll differ diff --git a/Business/bin/Debug/netstandard2.0/Core.pdb b/Business/bin/Debug/netstandard2.0/Core.pdb index 86f7a6f..3233ab5 100644 Binary files a/Business/bin/Debug/netstandard2.0/Core.pdb and b/Business/bin/Debug/netstandard2.0/Core.pdb differ diff --git a/Business/bin/Debug/netstandard2.0/DataAccess.dll b/Business/bin/Debug/netstandard2.0/DataAccess.dll index 8d3500b..5f14007 100644 Binary files a/Business/bin/Debug/netstandard2.0/DataAccess.dll and b/Business/bin/Debug/netstandard2.0/DataAccess.dll differ diff --git a/Business/bin/Debug/netstandard2.0/DataAccess.pdb b/Business/bin/Debug/netstandard2.0/DataAccess.pdb index 6fcb4d1..087efd6 100644 Binary files a/Business/bin/Debug/netstandard2.0/DataAccess.pdb and b/Business/bin/Debug/netstandard2.0/DataAccess.pdb differ diff --git a/Business/bin/Debug/netstandard2.0/Entities.dll b/Business/bin/Debug/netstandard2.0/Entities.dll index 859b4ac..aae76da 100644 Binary files a/Business/bin/Debug/netstandard2.0/Entities.dll and b/Business/bin/Debug/netstandard2.0/Entities.dll differ diff --git a/Business/bin/Debug/netstandard2.0/Entities.pdb b/Business/bin/Debug/netstandard2.0/Entities.pdb index 8533251..46aed1e 100644 Binary files a/Business/bin/Debug/netstandard2.0/Entities.pdb and b/Business/bin/Debug/netstandard2.0/Entities.pdb differ diff --git a/Business/obj/Debug/netstandard2.0/Business.csproj.CoreCompileInputs.cache b/Business/obj/Debug/netstandard2.0/Business.csproj.CoreCompileInputs.cache index 8da66fa..0daa9de 100644 --- a/Business/obj/Debug/netstandard2.0/Business.csproj.CoreCompileInputs.cache +++ b/Business/obj/Debug/netstandard2.0/Business.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -656d0b06cad8785ecf985ee2ad32b557b809e9e9 +8d537954dfa8152d86087da4e642afbaf065af20 diff --git a/Business/obj/Debug/netstandard2.0/Business.dll b/Business/obj/Debug/netstandard2.0/Business.dll index 5e258fa..6765a54 100644 Binary files a/Business/obj/Debug/netstandard2.0/Business.dll and b/Business/obj/Debug/netstandard2.0/Business.dll differ diff --git a/Business/obj/Debug/netstandard2.0/Business.pdb b/Business/obj/Debug/netstandard2.0/Business.pdb index 00d31c8..c379085 100644 Binary files a/Business/obj/Debug/netstandard2.0/Business.pdb and b/Business/obj/Debug/netstandard2.0/Business.pdb differ diff --git a/ConsoleUI/Program.cs b/ConsoleUI/Program.cs index e9f9086..58513c9 100644 --- a/ConsoleUI/Program.cs +++ b/ConsoleUI/Program.cs @@ -11,18 +11,60 @@ class Program { static void Main(string[] args) { - CarManager carManager = new CarManager(new EfCarDal()); - - //Car car1 = new Car(); - //car1.Id = 2; - //car1.BrandId = 2; - //car1.CarName = "Kia"; - //car1.ColorId = 2; - //car1.ModelYear = 2016; - //car1.DailyPrice = 155000; - //car1.Description = "Kia Rio 1.3 motor"; - //carManager.Add(car1); + //CarsAddTest(carManager); + //CarsInfoListed(carManager); + //UserAddTest(userManager); + //CustomerAddTest(); + //RentalRentTest(); + } + + private static void RentalRentTest() + { + RentalManager rentalManager = new RentalManager(new EfRentalDal()); + Rental rental1 = new Rental(); + rental1.CarId = 1; + rental1.CustomerId = 1; + rental1.RentDate = new DateTime(2021, 08, 13); + rental1.ReturnDate = new DateTime(2021, 09, 13); + + + var result = rentalManager.Delete(rental1); + Console.WriteLine(result.Message); + } + + private static void CustomerAddTest() + { + CustomerManager customerManager = new CustomerManager(new EfCustomerDal()); + Customer customer1 = new Customer(); + customer1.CustomerId = 1; + customer1.UserId = 1; + customer1.CompanyName = "Starlink"; + customerManager.Add(customer1); + } + + private static void UserAddTest(UserManager userManager) + { + User user1 = new User(); + user1.FirstName = "Yusuf Enes"; + user1.LastName = "Aras"; + user1.Password = "12345"; + user1.Email = "enesaras551@gmail.com"; + userManager.Add(user1); + } + + private static void CarsAddTest(CarManager carManager) + { + Car car1 = new Car(); + car1.CarName = "Kia Rio"; + car1.ModelYear = 2016; + car1.DailyPrice = 155000; + car1.Description = "Kia Rio 1.3 motor"; + carManager.Add(car1); + } + + private static void CarsInfoListed(CarManager carManager) + { var result = carManager.GetCarDetails(); if (result.Success == true) { @@ -38,22 +80,6 @@ static void Main(string[] args) { Console.WriteLine(result.Message); } - - - - /* - * BrandManager brandManager = new BrandManager(new EfBrandDal()); - foreach (var brand in brandManager.GetAll()) - { - Console.WriteLine($"Araba Markası: {brand.BrandName}\n"); - } - - ColorManager colorManager = new ColorManager(new EfColorDal()); - foreach (var color in colorManager.GetAll()) - { - Console.WriteLine($"Araba Rengi: {color.ColorName}\n"); - } - */ } } } diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/Business.dll b/ConsoleUI/bin/Debug/netcoreapp3.1/Business.dll index 5e258fa..6765a54 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/Business.dll and b/ConsoleUI/bin/Debug/netcoreapp3.1/Business.dll differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/Business.pdb b/ConsoleUI/bin/Debug/netcoreapp3.1/Business.pdb index 00d31c8..c379085 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/Business.pdb and b/ConsoleUI/bin/Debug/netcoreapp3.1/Business.pdb differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.dll b/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.dll index d05c747..e3d1451 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.dll and b/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.dll differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.pdb b/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.pdb index d56ab31..4ec8faf 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.pdb and b/ConsoleUI/bin/Debug/netcoreapp3.1/ConsoleUI.pdb differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/Core.dll b/ConsoleUI/bin/Debug/netcoreapp3.1/Core.dll index 08f27c6..5254373 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/Core.dll and b/ConsoleUI/bin/Debug/netcoreapp3.1/Core.dll differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/Core.pdb b/ConsoleUI/bin/Debug/netcoreapp3.1/Core.pdb index 86f7a6f..3233ab5 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/Core.pdb and b/ConsoleUI/bin/Debug/netcoreapp3.1/Core.pdb differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.dll b/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.dll index 8d3500b..5f14007 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.dll and b/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.dll differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.pdb b/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.pdb index 6fcb4d1..087efd6 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.pdb and b/ConsoleUI/bin/Debug/netcoreapp3.1/DataAccess.pdb differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.dll b/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.dll index 859b4ac..aae76da 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.dll and b/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.dll differ diff --git a/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.pdb b/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.pdb index 8533251..46aed1e 100644 Binary files a/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.pdb and b/ConsoleUI/bin/Debug/netcoreapp3.1/Entities.pdb differ diff --git a/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.csproj.AssemblyReference.cache b/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.csproj.AssemblyReference.cache index fb64d58..300397e 100644 Binary files a/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.csproj.AssemblyReference.cache and b/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.csproj.AssemblyReference.cache differ diff --git a/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.dll b/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.dll index d05c747..e3d1451 100644 Binary files a/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.dll and b/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.dll differ diff --git a/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.pdb b/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.pdb index d56ab31..4ec8faf 100644 Binary files a/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.pdb and b/ConsoleUI/obj/Debug/netcoreapp3.1/ConsoleUI.pdb differ diff --git a/Core/Core.csproj b/Core/Core.csproj index 6413e0f..5bb3658 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -160,6 +160,7 @@ + diff --git a/Core/DataAccess/IEntityRepository.cs b/Core/DataAccess/IEntityRepository.cs index 4e73a0c..4bbd0f6 100644 --- a/Core/DataAccess/IEntityRepository.cs +++ b/Core/DataAccess/IEntityRepository.cs @@ -13,8 +13,8 @@ namespace Core.DataAccess { List GetAll(Expression> filter = null); T Get(Expression> filter); - void Add(T car); - void Update(T car); - void Delete(T car); + void Add(T entity); + void Update(T entity); + void Delete(T entity); } } diff --git a/Core/Utilities/BusinessRules/BusinessRule.cs b/Core/Utilities/BusinessRules/BusinessRule.cs new file mode 100644 index 0000000..fa88990 --- /dev/null +++ b/Core/Utilities/BusinessRules/BusinessRule.cs @@ -0,0 +1,24 @@ +using Core.Utilities.Results; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Core.Utilities.BusinessRules +{ + public class BusinessRule + { + public static IResult Run(params IResult[] logics) + { + foreach (var logic in logics) + { + if (!logic.Success) + { + return logic; + } + } + return null; + } + } +} diff --git a/Core/bin/Debug/Core.dll b/Core/bin/Debug/Core.dll index 08f27c6..5254373 100644 Binary files a/Core/bin/Debug/Core.dll and b/Core/bin/Debug/Core.dll differ diff --git a/Core/bin/Debug/Core.pdb b/Core/bin/Debug/Core.pdb index 86f7a6f..3233ab5 100644 Binary files a/Core/bin/Debug/Core.pdb and b/Core/bin/Debug/Core.pdb differ diff --git a/Core/obj/Debug/Core.csproj.CoreCompileInputs.cache b/Core/obj/Debug/Core.csproj.CoreCompileInputs.cache index 3ed7991..f496bf4 100644 --- a/Core/obj/Debug/Core.csproj.CoreCompileInputs.cache +++ b/Core/obj/Debug/Core.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -3a3f2b872a02567498b6ded3c2f81638ee87f1fc +ee531b2f412a066be80a4bc1a4d4d2cf146c0c50 diff --git a/Core/obj/Debug/Core.dll b/Core/obj/Debug/Core.dll index 08f27c6..5254373 100644 Binary files a/Core/obj/Debug/Core.dll and b/Core/obj/Debug/Core.dll differ diff --git a/Core/obj/Debug/Core.pdb b/Core/obj/Debug/Core.pdb index 86f7a6f..3233ab5 100644 Binary files a/Core/obj/Debug/Core.pdb and b/Core/obj/Debug/Core.pdb differ diff --git a/DataAccess/Abstract/ICustomerDal.cs b/DataAccess/Abstract/ICustomerDal.cs new file mode 100644 index 0000000..0d6fa90 --- /dev/null +++ b/DataAccess/Abstract/ICustomerDal.cs @@ -0,0 +1,12 @@ +using Core.DataAccess; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace DataAccess.Abstract +{ + public interface ICustomerDal : IEntityRepository + { + } +} diff --git a/DataAccess/Abstract/IRentalDal.cs b/DataAccess/Abstract/IRentalDal.cs new file mode 100644 index 0000000..93f2444 --- /dev/null +++ b/DataAccess/Abstract/IRentalDal.cs @@ -0,0 +1,12 @@ +using Core.DataAccess; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace DataAccess.Abstract +{ + public interface IRentalDal : IEntityRepository + { + } +} diff --git a/DataAccess/Abstract/IUserDal.cs b/DataAccess/Abstract/IUserDal.cs new file mode 100644 index 0000000..9fb9d83 --- /dev/null +++ b/DataAccess/Abstract/IUserDal.cs @@ -0,0 +1,12 @@ +using Core.DataAccess; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace DataAccess.Abstract +{ + public interface IUserDal : IEntityRepository + { + } +} diff --git a/DataAccess/Concrete/EntityFramework/EfCarDal.cs b/DataAccess/Concrete/EntityFramework/EfCarDal.cs index 40c2265..3067055 100644 --- a/DataAccess/Concrete/EntityFramework/EfCarDal.cs +++ b/DataAccess/Concrete/EntityFramework/EfCarDal.cs @@ -25,7 +25,6 @@ join co in context.Colors on c.ColorId equals co.ColorId select new CarDetailDto { - Id = c.Id, CarName = c.CarName, BrandName = b.BrandName, ColorName = co.ColorName, diff --git a/DataAccess/Concrete/EntityFramework/EfCustomerDal.cs b/DataAccess/Concrete/EntityFramework/EfCustomerDal.cs new file mode 100644 index 0000000..8488723 --- /dev/null +++ b/DataAccess/Concrete/EntityFramework/EfCustomerDal.cs @@ -0,0 +1,13 @@ +using Core.DataAccess.EntityFramework; +using DataAccess.Abstract; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace DataAccess.Concrete.EntityFramework +{ + public class EfCustomerDal:EfEntityRepositoryBase, ICustomerDal + { + } +} diff --git a/DataAccess/Concrete/EntityFramework/EfRentalDal.cs b/DataAccess/Concrete/EntityFramework/EfRentalDal.cs new file mode 100644 index 0000000..363cadd --- /dev/null +++ b/DataAccess/Concrete/EntityFramework/EfRentalDal.cs @@ -0,0 +1,13 @@ +using Core.DataAccess.EntityFramework; +using DataAccess.Abstract; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace DataAccess.Concrete.EntityFramework +{ + public class EfRentalDal : EfEntityRepositoryBase, IRentalDal + { + } +} diff --git a/DataAccess/Concrete/EntityFramework/EfUserDal.cs b/DataAccess/Concrete/EntityFramework/EfUserDal.cs new file mode 100644 index 0000000..88cab0b --- /dev/null +++ b/DataAccess/Concrete/EntityFramework/EfUserDal.cs @@ -0,0 +1,13 @@ +using Core.DataAccess.EntityFramework; +using DataAccess.Abstract; +using Entities.Concrete; +using System; +using System.Collections.Generic; +using System.Text; + +namespace DataAccess.Concrete.EntityFramework +{ + public class EfUserDal : EfEntityRepositoryBase, IUserDal + { + } +} diff --git a/DataAccess/Concrete/EntityFramework/ReCapContext.cs b/DataAccess/Concrete/EntityFramework/ReCapContext.cs index fc57b8f..25b8bc3 100644 --- a/DataAccess/Concrete/EntityFramework/ReCapContext.cs +++ b/DataAccess/Concrete/EntityFramework/ReCapContext.cs @@ -16,5 +16,8 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) public DbSet Cars { get; set; } public DbSet Brands { get; set; } public DbSet Colors { get; set; } + public DbSet Users { get; set; } + public DbSet Customers { get; set; } + public DbSet Rentals { get; set; } } } diff --git a/DataAccess/Concrete/InMemory/InMemoryCarDal.cs b/DataAccess/Concrete/InMemory/InMemoryCarDal.cs index 7b39c39..a4a0eaa 100644 --- a/DataAccess/Concrete/InMemory/InMemoryCarDal.cs +++ b/DataAccess/Concrete/InMemory/InMemoryCarDal.cs @@ -18,11 +18,11 @@ public InMemoryCarDal() { _car = new List() { - new Car{Id=1,BrandId=1,ColorId=1,ModelYear=2015,DailyPrice=175,Description="KIA"}, - new Car{Id=2,BrandId=1,ColorId=2,ModelYear=2020,DailyPrice=200,Description="BMW"}, - new Car{Id=3,BrandId=2,ColorId=2,ModelYear=2018,DailyPrice=125,Description="FORD"}, - new Car{Id=4,BrandId=3,ColorId=2,ModelYear=2020,DailyPrice=180,Description="Audi"}, - new Car{Id=5,BrandId=4,ColorId=3,ModelYear=2021,DailyPrice=250,Description="Mercedes"} + new Car{CarId=1,BrandId=1,ColorId=1,ModelYear=2015,DailyPrice=175,Description="KIA"}, + new Car{CarId=2,BrandId=1,ColorId=2,ModelYear=2020,DailyPrice=200,Description="BMW"}, + new Car{CarId=3,BrandId=2,ColorId=2,ModelYear=2018,DailyPrice=125,Description="FORD"}, + new Car{CarId=4,BrandId=3,ColorId=2,ModelYear=2020,DailyPrice=180,Description="Audi"}, + new Car{CarId=5,BrandId=4,ColorId=3,ModelYear=2021,DailyPrice=250,Description="Mercedes"} }; } public void Add(Car car) @@ -32,7 +32,7 @@ public void Add(Car car) public void Delete(Car car) { - Car CarToDelete = _car.SingleOrDefault(c => c.Id == car.Id); + Car CarToDelete = _car.SingleOrDefault(c => c.CarId == car.CarId); _car.Remove(CarToDelete); } @@ -53,7 +53,7 @@ public List GetAll(Expression> filter = null) public List GetById(int carId) { - return _car.Where(c => c.Id == carId).ToList(); + return _car.Where(c => c.CarId == carId).ToList(); } public List GetCarDetails() @@ -63,7 +63,7 @@ public List GetCarDetails() public void Update(Car car) { - Car carToUpdate = _car.SingleOrDefault(c => c.Id == car.Id); + Car carToUpdate = _car.SingleOrDefault(c => c.CarId == car.CarId); carToUpdate.BrandId = car.BrandId; carToUpdate.ColorId = car.ColorId; carToUpdate.ModelYear = car.ModelYear; diff --git a/DataAccess/bin/Debug/netstandard2.0/Core.dll b/DataAccess/bin/Debug/netstandard2.0/Core.dll index 08f27c6..5254373 100644 Binary files a/DataAccess/bin/Debug/netstandard2.0/Core.dll and b/DataAccess/bin/Debug/netstandard2.0/Core.dll differ diff --git a/DataAccess/bin/Debug/netstandard2.0/Core.pdb b/DataAccess/bin/Debug/netstandard2.0/Core.pdb index 86f7a6f..3233ab5 100644 Binary files a/DataAccess/bin/Debug/netstandard2.0/Core.pdb and b/DataAccess/bin/Debug/netstandard2.0/Core.pdb differ diff --git a/DataAccess/bin/Debug/netstandard2.0/DataAccess.dll b/DataAccess/bin/Debug/netstandard2.0/DataAccess.dll index 8d3500b..5f14007 100644 Binary files a/DataAccess/bin/Debug/netstandard2.0/DataAccess.dll and b/DataAccess/bin/Debug/netstandard2.0/DataAccess.dll differ diff --git a/DataAccess/bin/Debug/netstandard2.0/DataAccess.pdb b/DataAccess/bin/Debug/netstandard2.0/DataAccess.pdb index 6fcb4d1..087efd6 100644 Binary files a/DataAccess/bin/Debug/netstandard2.0/DataAccess.pdb and b/DataAccess/bin/Debug/netstandard2.0/DataAccess.pdb differ diff --git a/DataAccess/bin/Debug/netstandard2.0/Entities.dll b/DataAccess/bin/Debug/netstandard2.0/Entities.dll index 859b4ac..aae76da 100644 Binary files a/DataAccess/bin/Debug/netstandard2.0/Entities.dll and b/DataAccess/bin/Debug/netstandard2.0/Entities.dll differ diff --git a/DataAccess/bin/Debug/netstandard2.0/Entities.pdb b/DataAccess/bin/Debug/netstandard2.0/Entities.pdb index 8533251..46aed1e 100644 Binary files a/DataAccess/bin/Debug/netstandard2.0/Entities.pdb and b/DataAccess/bin/Debug/netstandard2.0/Entities.pdb differ diff --git a/DataAccess/obj/Debug/netstandard2.0/DataAccess.csproj.CoreCompileInputs.cache b/DataAccess/obj/Debug/netstandard2.0/DataAccess.csproj.CoreCompileInputs.cache index b471227..d794e4c 100644 --- a/DataAccess/obj/Debug/netstandard2.0/DataAccess.csproj.CoreCompileInputs.cache +++ b/DataAccess/obj/Debug/netstandard2.0/DataAccess.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -2bf4ad2eb71eeca05134781cb2466920ce0ab313 +1ae0cbcef831d149cd6e3782b243b7d937e3bfd9 diff --git a/DataAccess/obj/Debug/netstandard2.0/DataAccess.dll b/DataAccess/obj/Debug/netstandard2.0/DataAccess.dll index 8d3500b..5f14007 100644 Binary files a/DataAccess/obj/Debug/netstandard2.0/DataAccess.dll and b/DataAccess/obj/Debug/netstandard2.0/DataAccess.dll differ diff --git a/DataAccess/obj/Debug/netstandard2.0/DataAccess.pdb b/DataAccess/obj/Debug/netstandard2.0/DataAccess.pdb index 6fcb4d1..087efd6 100644 Binary files a/DataAccess/obj/Debug/netstandard2.0/DataAccess.pdb and b/DataAccess/obj/Debug/netstandard2.0/DataAccess.pdb differ diff --git a/Entities/Concrete/Car.cs b/Entities/Concrete/Car.cs index 9a4fade..e4cc231 100644 --- a/Entities/Concrete/Car.cs +++ b/Entities/Concrete/Car.cs @@ -7,7 +7,7 @@ namespace Entities.Concrete { public class Car : IEntity { - public int Id { get; set; } + public int CarId { get; set; } public int BrandId { get; set; } public int ColorId { get; set; } public int ModelYear { get; set; } diff --git a/Entities/Concrete/Customer.cs b/Entities/Concrete/Customer.cs new file mode 100644 index 0000000..58ecf7f --- /dev/null +++ b/Entities/Concrete/Customer.cs @@ -0,0 +1,14 @@ +using Core.Entities; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Entities.Concrete +{ + public class Customer:IEntity + { + public int CustomerId { get; set; } + public int UserId { get; set; } + public string CompanyName { get; set; } + } +} diff --git a/Entities/Concrete/Rental.cs b/Entities/Concrete/Rental.cs new file mode 100644 index 0000000..1ad75e3 --- /dev/null +++ b/Entities/Concrete/Rental.cs @@ -0,0 +1,17 @@ +using Core.Entities; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Entities.Concrete +{ + public class Rental: IEntity + { + public int Id { get; set; } + public int CarId { get; set; } + public int CustomerId { get; set; } + public DateTime RentDate { get; set; } + public DateTime ReturnDate { get; set; } + + } +} diff --git a/Entities/Concrete/User.cs b/Entities/Concrete/User.cs new file mode 100644 index 0000000..915e05e --- /dev/null +++ b/Entities/Concrete/User.cs @@ -0,0 +1,16 @@ +using Core.Entities; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Entities.Concrete +{ + public class User:IEntity + { + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + } +} diff --git a/Entities/bin/Debug/netstandard2.0/Core.dll b/Entities/bin/Debug/netstandard2.0/Core.dll index 08f27c6..5254373 100644 Binary files a/Entities/bin/Debug/netstandard2.0/Core.dll and b/Entities/bin/Debug/netstandard2.0/Core.dll differ diff --git a/Entities/bin/Debug/netstandard2.0/Core.pdb b/Entities/bin/Debug/netstandard2.0/Core.pdb index 86f7a6f..3233ab5 100644 Binary files a/Entities/bin/Debug/netstandard2.0/Core.pdb and b/Entities/bin/Debug/netstandard2.0/Core.pdb differ diff --git a/Entities/bin/Debug/netstandard2.0/Entities.dll b/Entities/bin/Debug/netstandard2.0/Entities.dll index 859b4ac..aae76da 100644 Binary files a/Entities/bin/Debug/netstandard2.0/Entities.dll and b/Entities/bin/Debug/netstandard2.0/Entities.dll differ diff --git a/Entities/bin/Debug/netstandard2.0/Entities.pdb b/Entities/bin/Debug/netstandard2.0/Entities.pdb index 8533251..46aed1e 100644 Binary files a/Entities/bin/Debug/netstandard2.0/Entities.pdb and b/Entities/bin/Debug/netstandard2.0/Entities.pdb differ diff --git a/Entities/obj/Debug/netstandard2.0/Entities.csproj.CoreCompileInputs.cache b/Entities/obj/Debug/netstandard2.0/Entities.csproj.CoreCompileInputs.cache index e098a3c..d53c301 100644 --- a/Entities/obj/Debug/netstandard2.0/Entities.csproj.CoreCompileInputs.cache +++ b/Entities/obj/Debug/netstandard2.0/Entities.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -6ec7e7ec4b655a702aafb93cada9eb5d050feac5 +88087c73c20492ad9cc5d5cfb07dbc41d2179846 diff --git a/Entities/obj/Debug/netstandard2.0/Entities.dll b/Entities/obj/Debug/netstandard2.0/Entities.dll index 859b4ac..aae76da 100644 Binary files a/Entities/obj/Debug/netstandard2.0/Entities.dll and b/Entities/obj/Debug/netstandard2.0/Entities.dll differ diff --git a/Entities/obj/Debug/netstandard2.0/Entities.pdb b/Entities/obj/Debug/netstandard2.0/Entities.pdb index 8533251..46aed1e 100644 Binary files a/Entities/obj/Debug/netstandard2.0/Entities.pdb and b/Entities/obj/Debug/netstandard2.0/Entities.pdb differ