コード例 #1
0
 //
 // GET: /CatalogManager/Delete/5
 public ActionResult Delete(int id)
 {
     /*Car car = db.Cars.Find(id);*/
     CatalogManagerDAL dal = new CatalogManagerDAL();
     Car car = dal.delete(id);
     return View(car);
 }
コード例 #2
0
 // [HostType("ASP.NET")]
 // [AspNetDevelopmentServerHost("C:\\Users\\cezar\\MvcAA\\MvcAutoAuction1\\MvcAutoAuction", "/")]
 public void indexCarsTest()
 {
     CatalogManagerDAL target = new CatalogManagerDAL(); // TODO: Initialize to an appropriate value
     // List<Car> expected = null; // TODO: Initialize to an appropriate value
     List<Car> actual;
     actual = target.indexCars();
     Assert.IsNotNull(actual);
     // Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #3
0
 public ActionResult DeleteConfirmed(int id)
 {
     /*Car car = db.Cars.Find(id);
     db.Cars.Remove(car);
     db.SaveChanges();*/
     CatalogManagerDAL dal = new CatalogManagerDAL();
     dal.deleteConfirm(id);
     return RedirectToAction("Index");
 }
コード例 #4
0
        //
        // GET: /CatalogManager/Create
        public ActionResult Create()
        {
            /*ViewBag.BrandId = new SelectList(db.Brands, "BrandId", "Name");
            ViewBag.AutoId = new SelectList(db.Autos, "AutoId", "Name");*/
            CatalogManagerDAL dal = new CatalogManagerDAL();
            List<SelectList> id = dal.create();

            ViewBag.BrandId = id[0];
            ViewBag.AutoId = id[1];

            return View();
        }
コード例 #5
0
        public ActionResult Create(Car car)
        {
            if (ModelState.IsValid)
            {
                CatalogManagerDAL dal = new CatalogManagerDAL();
                dal.createStore(car);
                return RedirectToAction("Index");
            }

            /* ViewBag.BrandId = new SelectList(db.Brands, "BrandId", "Name", car.BrandId);
             ViewBag.AutoId = new SelectList(db.Autos, "AutoId", "Name", car.AutoId);
             return View(car);*/
            CatalogManagerDAL dal2 = new CatalogManagerDAL();
            List<SelectList> id = dal2.create();

            ViewBag.BrandId = id[0];
            ViewBag.AutoId = id[1];

            return View(car);
        }
コード例 #6
0
 public void CatalogDALConstructorTest()
 {
     CatalogManagerDAL target = new CatalogManagerDAL();
     // Assert.Inconclusive("TODO: Implement code to verify target");
 }
コード例 #7
0
        //
        // GET: /CatalogManager/Edit/5
        public ActionResult Edit(int id)
        {
            /*Car car = db.Cars.Find(id);
            ViewBag.BrandId = new SelectList(db.Brands, "BrandId", "Name", car.BrandId);
            ViewBag.AutoId = new SelectList(db.Autos, "AutoId", "Name", car.AutoId);*/
            CatalogManagerDAL dal = new CatalogManagerDAL();
            Car car = dal.edit(id);

            CatalogManagerDAL dal2 = new CatalogManagerDAL();
            List<SelectList> id2 = dal2.create();

            ViewBag.BrandId = id2[0];
            ViewBag.AutoId = id2[1];

            return View(car);
        }
コード例 #8
0
 //
 // GET: /CatalogManager/Details/5
 public ViewResult Details(int id)
 {
     /*Car car = db.Cars.Find(id);*/
     CatalogManagerDAL dal = new CatalogManagerDAL();
     Car car = dal.details(id);
     return View(car);
 }
コード例 #9
0
 //
 // GET: /CatalogManager/
 public ViewResult Index()
 {
     /*var cars = db.Cars.Include(c => c.Brand).Include(c => c.Auto);
     return View(cars.ToList());*/
     CatalogManagerDAL dal = new CatalogManagerDAL();
     var cars = dal.indexCars();
     return View(cars);
 }
コード例 #10
0
        public ActionResult Edit(Car car)
        {
            if (ModelState.IsValid)
            {
                db.Entry(car).State = EntityState.Modified;
                db.SaveChanges();
                /* CatalogManagerDAL dal = new CatalogManagerDAL();
                 dal.editStore(car);
                 return RedirectToAction("Index");*/
            }
            /*ViewBag.BrandId = new SelectList(db.Brands, "BrandId", "Name", car.BrandId);
            ViewBag.AutoId = new SelectList(db.Autos, "AutoId", "Name", car.AutoId);*/

            CatalogManagerDAL dal2 = new CatalogManagerDAL();
            List<SelectList> id = dal2.create();

            ViewBag.BrandId = id[0];
            ViewBag.AutoId = id[1];

            return View(car);
        }