Ejemplo n.º 1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            VehicleMedia vehicleMedia = await db.VehicleMedias.FindAsync(id);

            db.VehicleMedias.Remove(vehicleMedia);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Path")] VehicleMedia vehicleMedia)
        {
            if (ModelState.IsValid)
            {
                ApplicationUser applicationUser = db.Users.Find(User.Identity.GetUserId());
                vehicleMedia.Added_User      = applicationUser;
                db.Entry(vehicleMedia).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View("~/Views/Vehicle/VehicleMedias/Edit.cshtml", vehicleMedia));
        }
Ejemplo n.º 3
0
        // GET: VehicleMedias/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VehicleMedia vehicleMedia = await db.VehicleMedias.FindAsync(id);

            if (vehicleMedia == null)
            {
                return(HttpNotFound());
            }
            return(View("~/Views/Vehicle/VehicleMedias/Edit.cshtml", vehicleMedia));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Path")] VehicleMedia vehicleMedia)
        {
            if (ModelState.IsValid)
            {
                ApplicationUser applicationUser = db.Users.Find(User.Identity.GetUserId());
                vehicleMedia.Added_User = applicationUser;
                vehicleMedia.IsActive   = true;
                db.VehicleMedias.Add(vehicleMedia);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View("~/Views/Vehicle/VehicleMedias/Create.cshtml", vehicleMedia));
        }