Exemplo n.º 1
0
 public ActionResult Edit(CarType cartype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cartype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cartype));
 }
Exemplo n.º 2
0
 public ActionResult Edit(Parameters parameters)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parameters).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parameters));
 }
 public ActionResult Edit(TicketState ticketstate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ticketstate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ticketstate));
 }
Exemplo n.º 4
0
 public ActionResult Edit(Car car)
 {
     if (ModelState.IsValid)
     {
         db.Entry(car).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CarTypeId = new SelectList(db.CarType, "CarTypeId", "description", car.CarTypeId);
     return(View(car));
 }
Exemplo n.º 5
0
        public ActionResult SalidaConfirmada(int id)
        {
            Ticket ticket = db.Ticket.Find(id);

            if (ModelState.IsValid)
            {
                ticket.FinishDateTime = DateTime.Now;
                TimeSpan timetotal = ticket.FinishDateTime.Value.Subtract(ticket.StartDateTime);
                double   Horas     = timetotal.TotalHours;
                ticket.TotalTime     = (float)Horas;
                ticket.TotalPrice    = ticket.TotalTime * ticket.Car.CarType.tarifa;
                ticket.TicketStateId = 2;

                db.Entry(ticket).State = EntityState.Modified;
                db.SaveChanges();
                Controllers.TicketLogsController.GuardarSalida(User.Identity.Name, ticket);
                return(RedirectToAction("Details", new { id = ticket.TicketId }));
            }

            return(View());
        }
Exemplo n.º 6
0
        public ActionResult Edit(User user)
        {
            if (ModelState.IsValid)
            {
                var crypto = new SimpleCrypto.PBKDF2();

                var encrpPass = crypto.Compute(user.Clave);

                user.Clave     = encrpPass;
                user.ClaveSalt = crypto.Salt;

                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            ViewBag.UserTypeId = new SelectList(db.Usertype, "usertypeid", "description", user.UserTypeId);
            return(View(user));
        }
Exemplo n.º 7
0
 public ActionResult Edit(Usertype usertype)
 {
     if (ModelState.IsValid)
     {
         // Comprueba que no haya un tipo de usuario igual
         var ut = db.Usertype.FirstOrDefault(u => u.description == usertype.description);
         if (ut == null)
         {
             db.Entry(usertype).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Ya existe un tipo de usuario igual");
         }
     }
     return(View(usertype));
 }