コード例 #1
0
        private void InitializeTestData()
        {
            var articleRepositoryStub     = MockRepository.GenerateMock <IRepository <articles> >();
            var articleTypeRepositoryStub = MockRepository.GenerateMock <IRepository <articleTypes> >();
            var customerRepositoryStub    = MockRepository.GenerateMock <IRepository <customers> >();
            var categoryRepositoryStub    = MockRepository.GenerateMock <IRepository <categories> >();
            var articleService            = new ArticleService(articleRepositoryStub, articleTypeRepositoryStub, customerRepositoryStub, categoryRepositoryStub);

            moto = new moto()
            {
                title       = "moto 1",
                detail      = "moto 1 detail",
                customer_id = 1,
                category_Id = 1,
                precio      = 10,
                vin         = "001"
            };
            articleService.CreateModel(moto);

            auto = new auto()
            {
                title       = "auto 1",
                detail      = "auto 1 detail",
                customer_id = 1,
                category_Id = 1,
                price_auto  = 50,
                kilometraje = "100 km"
            };
            articleService.CreateModel(auto);
        }
コード例 #2
0
        private void CaricaDatiDiTesto()
        {
            moto m = new moto();

            m = new moto("Ducati", "Panigale V4R", 1000, 75, DateTime.Now, 0, "blu", false, false, 11300, "StandarCO");
            listVeicolo.Add(m);
            auto a = new auto("Alfa Romeo", "Stelvio", 2000, 150, DateTime.Now, 0, "rosso", false, false, 10000, 8);

            listVeicolo.Add(a);
            lbVeicoli.DataSource = listVeicolo;
        }
コード例 #3
0
ファイル: Delete.cshtml.cs プロジェクト: ArturGhi/proiect
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            moto = await _context.moto
                   .Include(m => m.Dealer).FirstOrDefaultAsync(m => m.id == id);

            if (moto == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #4
0
ファイル: Delete.cshtml.cs プロジェクト: ArturGhi/proiect
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            moto = await _context.moto.FindAsync(id);

            if (moto != null)
            {
                _context.moto.Remove(moto);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #5
0
ファイル: Edit.cshtml.cs プロジェクト: ArturGhi/proiect
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            moto = await _context.moto
                   .Include(m => m.Dealer).FirstOrDefaultAsync(m => m.id == id);

            if (moto == null)
            {
                return(NotFound());
            }
            ViewData["DealerID"] = new SelectList(_context.Dealer, "ID", "DealerName");
            return(Page());
        }
コード例 #6
0
 public MotoViewModel(moto entity)
 {
     this.id          = entity.Id;
     this.title       = entity.title;
     this.detail      = entity.detail;
     this.price       = entity.price;
     this.date        = entity.date;
     this.customer_id = entity.customer_id;
     this.category_Id = entity.category_Id;
     this.resources   = entity.resources;
     this.marca       = entity.marca;
     this.modelo      = entity.modelo;
     this.anio        = entity.anio;
     this.kilometraje = entity.kilometraje;
     this.vin         = entity.vin;
     this.condicion   = entity.condicion;
     this.articleType = entity.GetType().BaseType.Name;
 }
コード例 #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("\t\t\t----- SALONE VEICOLI USATI E NUOVI -----\n");

            string scelta;
            string tabella;

            do
            {
                Console.Write("\nFAI UNA SCELTA: (per vedere le scelte possibili premere H) ");
                scelta = Console.ReadLine().Trim().ToUpper();

                switch (scelta)
                {
                case "H":
                    Console.WriteLine("\n" + File.ReadAllText(@".\Comandi.txt") + "\n");
                    break;

                case "C": Console.Write("Creare tabella Auto o Moto? [auto/moto]: ");
                    tabella = Console.ReadLine().Trim().ToLower(); CreateTable(tabella); break;

                case "A":
                    Console.WriteLine("\n\t\t\tAGGIUNGI VEICOLO\n");
                    Console.Write("Auto o Moto? [A/M]: ");
                    veicolo v;
                    string  VeicoloScelto = Console.ReadLine().Trim().ToUpper();
                    if (VeicoloScelto == "A" || VeicoloScelto == "M")
                    {
                        if (VeicoloScelto == "A")
                        {
                            v = new auto();
                        }
                        else
                        {
                            v = new moto();
                        }
                    }
                    else
                    {
                        break;
                    }
                    AddNewVehicle(v);

                    break;

                case "LS": Console.Write("\nInserisci il nome della tabella da visualizzare [auto/moto]: ");
                    tabella = Console.ReadLine().Trim().ToLower(); CarList(tabella); break;

                case "D":
                    Console.Write("\nInserisci il nome della tabella da eliminare [auto/moto]: ");
                    tabella = Console.ReadLine().Trim().ToLower(); DropTable(tabella); break;

                case "CS": Console.Clear();
                    Console.WriteLine("\t\t\t----- SALONE VEICOLI USATI E NUOVI -----\n"); break;

                case "X": break;

                default:
                    Console.WriteLine("Comando non disponibile!");
                    Console.ReadKey();
                    Console.Clear();
                    break;
                }
            } while (scelta != "X");
        }