Beispiel #1
0
        public async Task <ActionResult> Edit([Bind(Include = "ID,OilType,OilFilter,Miles,Date,Cost,Notes,CarID")] OilPlusFilter oilPlusFilter)
        {
            if (ModelState.IsValid)
            {
                db.Entry(oilPlusFilter).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index", new { CarID = oilPlusFilter.CarID }));
            }
            if (oilPlusFilter.CarID > 0)
            {
                ViewBag.CarID = oilPlusFilter.CarID;
                UpdateCarDescription(oilPlusFilter.CarID);
                PopulateCarDropDownList(oilPlusFilter.CarID);
            }
            return(View(oilPlusFilter));
        }
Beispiel #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OilPlusFilter oilPlusFilter = await db.OilPlusFilter.FindAsync(id);

            if (oilPlusFilter.CarID > 0)
            {
                ViewBag.CarID = oilPlusFilter.CarID;
                UpdateCarDescription(oilPlusFilter.CarID);
            }
            db.OilPlusFilter.Remove(oilPlusFilter);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #3
0
        // GET: OilPlusFilter/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null || id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OilPlusFilter oilPlusFilter = await db.OilPlusFilter.FindAsync(id);

            if (oilPlusFilter == null)
            {
                return(HttpNotFound());
            }
            else if (oilPlusFilter.CarID > 0)
            {
                ViewBag.CarID = oilPlusFilter.CarID;
                UpdateCarDescription(oilPlusFilter.CarID);
            }
            return(View(oilPlusFilter));
        }