Esempio n. 1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Chofere chofere = await db.Choferes.FindAsync(id);

            db.Personas.Remove(chofere.Persona);
            db.Choferes.Remove(chofere);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <ActionResult> Create(Chofere chofere)
        {
            if (ModelState.IsValid)
            {
                db.Choferes.Add(chofere);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(chofere));
        }
Esempio n. 3
0
        // GET: Choferes/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Chofere chofere = await db.Choferes.FindAsync(id);

            if (chofere == null)
            {
                return(HttpNotFound());
            }
            return(View(chofere));
        }
Esempio n. 4
0
        public ActionResult Create()
        {
            Chofere chofer = new Chofere();

            chofer.usr_crea = UtilAut.GetUserId();
            chofer.fec_crea = DateTime.Now;
            chofer.Persona  = new Persona()
            {
                usr_crea = UtilAut.GetUserId(),
                fec_crea = DateTime.Now,
                activo   = true
            };
            return(View(chofer));
        }
Esempio n. 5
0
        public async Task <ActionResult> Edit(Chofere chofere)
        {
            if (ModelState.IsValid)
            {
                chofere.usr_modif               = UtilAut.GetUserId();
                chofere.fec_modif               = DateTime.Now;
                chofere.Persona.usr_modif       = UtilAut.GetUserId();
                chofere.Persona.fec_modif       = DateTime.Now;
                db.Entry(chofere.Persona).State = EntityState.Modified;
                db.Entry(chofere).State         = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(chofere));
        }