示例#1
0
        public ImplCarService()
        {
            var autoContext = new CarServiceContext();
            var unitOfWork  = new UnitOfWork(autoContext);

            var autoRepository           = new Repository <Auto>(unitOfWork);
            var clientRepository         = new Repository <Client>(unitOfWork);
            var comandaRepository        = new Repository <Comanda>(unitOfWork);
            var detaliuComandaRepository = new Repository <DetaliuComanda>(unitOfWork);
            var imagineRepository        = new Repository <Imagine>(unitOfWork);
            var materialRepository       = new Repository <Material>(unitOfWork);
            var mecanicRepository        = new Repository <Mecanic>(unitOfWork);
            var operatieRepository       = new Repository <Operatie>(unitOfWork);
            var sasiuRepository          = new Repository <Sasiu>(unitOfWork);

            clientService         = new ClientService(clientRepository, unitOfWork);
            autoService           = new AutoService(autoRepository, unitOfWork);
            comandaService        = new ComandaService(comandaRepository, unitOfWork);
            detaliuComandaService = new DetaliuComandaService(detaliuComandaRepository, unitOfWork);
            imagineService        = new ImagineService(imagineRepository, unitOfWork);
            materialService       = new MaterialService(materialRepository, unitOfWork);
            mecanicService        = new MecanicService(mecanicRepository, unitOfWork);
            operatieService       = new OperatieService(operatieRepository, unitOfWork);
            sasiuService          = new SasiuService(sasiuRepository, unitOfWork);
        }
示例#2
0
        static void Main(string[] args)
        {
            var autoContext = new CarServiceContext();
            var unitOfWork  = new UnitOfWork(autoContext);

            var autoRepository   = new Repository <Auto>(unitOfWork);
            var clientRepository = new Repository <Client>(unitOfWork);
            var sasiuRepository  = new Repository <Sasiu>(unitOfWork);


            var clientService = new ClientService(clientRepository, unitOfWork);
            var autoService   = new AutoService(autoRepository, unitOfWork);
            var sasiuService  = new SasiuService(sasiuRepository, unitOfWork);

            var sasiuDto = new SasiuDto
            {
                Denumire = "Fara Denumire",
                CodSasiu = "8D"
            };

            var updateSasiu = sasiuService.FindById(3);

            updateSasiu.CodSasiu = "8D";

            //sasiuService.CreateNew(sasiuDto);
            sasiuService.Update(updateSasiu);

            /*var client = new ClientDto
             * {
             *  Nume = "Nume1",
             *  Prenume = "Prenume1",
             *  Email = "*****@*****.**",
             *  Adresa = "Adresa1",
             *  Judet = "Judet1",
             *  Localitate = "Localitate1"
             * };*/

            //clientService.CreateNew(client);
            //clientService.Delete(5);
        }