コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            avtoAdvt avtoAdvt = db.avtoAdvt.Find(id);

            db.avtoAdvt.Remove(avtoAdvt);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        // GET: avtoAdvtss/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            avtoAdvt avtoAdvt = db.avtoAdvt.Find(id);

            if (avtoAdvt == null)
            {
                return(HttpNotFound());
            }
            return(View(avtoAdvt));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "id,price,photo,markaID,modelID,bodyType,colorID,engineVolumeID,motorPowerID,fuelTypeID,graduationYearID,mileage,driveUintID,transmissionID,additionalInfo,phone,contactsName,publicDate,viewSize")] avtoAdvt avtoAdvt)
 {
     if (ModelState.IsValid)
     {
         db.Entry(avtoAdvt).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.bodyType         = new SelectList(db.bodyType, "id", "name", avtoAdvt.bodyType);
     ViewBag.colorID          = new SelectList(db.color, "id", "name", avtoAdvt.colorID);
     ViewBag.driveUintID      = new SelectList(db.driveUnit, "id", "name", avtoAdvt.driveUintID);
     ViewBag.engineVolumeID   = new SelectList(db.engineVolume, "id", "name", avtoAdvt.engineVolumeID);
     ViewBag.fuelTypeID       = new SelectList(db.fuelType, "id", "name", avtoAdvt.fuelTypeID);
     ViewBag.graduationYearID = new SelectList(db.graduationYear, "id", "id", avtoAdvt.graduationYearID);
     ViewBag.markaID          = new SelectList(db.marka, "id", "name", avtoAdvt.markaID);
     ViewBag.modelID          = new SelectList(db.model, "id", "name", avtoAdvt.modelID);
     ViewBag.motorPowerID     = new SelectList(db.motorPower, "id", "name", avtoAdvt.motorPowerID);
     ViewBag.transmissionID   = new SelectList(db.transmission, "id", "name", avtoAdvt.transmissionID);
     return(View(avtoAdvt));
 }
コード例 #4
0
        // GET: avtoAdvtss/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            avtoAdvt avtoAdvt = db.avtoAdvt.Find(id);

            if (avtoAdvt == null)
            {
                return(HttpNotFound());
            }
            ViewBag.bodyType         = new SelectList(db.bodyType, "id", "name", avtoAdvt.bodyType);
            ViewBag.colorID          = new SelectList(db.color, "id", "name", avtoAdvt.colorID);
            ViewBag.driveUintID      = new SelectList(db.driveUnit, "id", "name", avtoAdvt.driveUintID);
            ViewBag.engineVolumeID   = new SelectList(db.engineVolume, "id", "name", avtoAdvt.engineVolumeID);
            ViewBag.fuelTypeID       = new SelectList(db.fuelType, "id", "name", avtoAdvt.fuelTypeID);
            ViewBag.graduationYearID = new SelectList(db.graduationYear, "id", "id", avtoAdvt.graduationYearID);
            ViewBag.markaID          = new SelectList(db.marka, "id", "name", avtoAdvt.markaID);
            ViewBag.modelID          = new SelectList(db.model, "id", "name", avtoAdvt.modelID);
            ViewBag.motorPowerID     = new SelectList(db.motorPower, "id", "name", avtoAdvt.motorPowerID);
            ViewBag.transmissionID   = new SelectList(db.transmission, "id", "name", avtoAdvt.transmissionID);
            return(View(avtoAdvt));
        }