public IActionResult AddEdit(Buses model)
 {
     if (ModelState.IsValid)
     {
         if (model.Id == 0)
         {
             _ctx.Buses.Add(model);
         }
         else
         {
             _ctx.Buses.Update(model);
         }
         _ctx.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Beispiel #2
0
 public IActionResult AddAvaliation(Avaliation model)
 {
     if (ModelState.IsValid)
     {
         _ctx.Avaliations.Add(model);
         _ctx.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
        public IActionResult ChangePassword(string oldpassword, string newpassword, string newpassword1)
        {
            int         id = int.Parse(HttpContext.Session.GetString("uid"));
            UserDetails c  = context.UserDetails.Where(x => x.UserDetailId == id).SingleOrDefault();

            if (oldpassword == c.Password && newpassword == newpassword1)
            {
                UserDetails cus = context.UserDetails.Where(x => x.UserName == c.UserName).SingleOrDefault();
                cus.Password = newpassword;
                SessionHelper.SetObjectAsJson(HttpContext.Session, "bookmovie", cus);
                context.SaveChanges();
            }
            else
            {
                ViewBag.Error = "  Invalid Credentials";
                return(View("Password"));
            }
            return(RedirectToAction("Login", "Ticket"));
        }
 public IActionResult Checkout(UserDetails UserDetails)
 {
     context.UserDetails.Add(UserDetails);
     context.SaveChanges();
     return(RedirectToAction("Index"));
 }