Beispiel #1
0
 public ActionResult EditDistancePrice(DistancePrice model)
 {
     if (Session["adminLog"] != null)
     {
         if (ModelState.IsValid)
         {
             db.Entry(model).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("DistancePrices"));
         }
         return(View(model));
     }
     return(RedirectToAction("login", "admin"));
 }
Beispiel #2
0
        public ActionResult AddDistancePriceValue(DistancePrice model, String MileFrom, String MileTo)
        {
            if (Session["adminLog"] != null)
            {
                model.MileFrom = Convert.ToInt32(MileFrom);
                model.MileTo   = Convert.ToInt32(MileTo);

                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                db.DistancePrices.Add(model);
                db.SaveChanges();
                return(RedirectToAction("DistancePrices", "Price"));
            }
            return(RedirectToAction("login", "admin"));
        }