예제 #1
0
        public ActionResult PriceCityCreate(FormCollection collection, PriceCity pc)
        {
            if (Request.Cookies["Username"] != null)
            {
                pc.Name       = collection["Name"];
                pc.Ord        = Int32.Parse(collection["Ord"]);
                pc.Price_ship = float.Parse(collection["Price_ship"]);

                string le = collection["PriceCity"];
                if (le.Length > 0)
                {
                    pc.Level = le + "00000";
                }
                else
                {
                    pc.Level = "00000";
                }
                db.PriceCities.Add(pc);
                db.SaveChanges();
                return(RedirectToAction("PriceCityIndex"));
            }
            else
            {
                return(Redirect("/Admins/admins"));
            }
        }
예제 #2
0
        public ActionResult PriceCityEdit(FormCollection collection, PriceCity pc)
        {
            if (Request.Cookies["Username"] != null)
            {
                pc.Name       = collection["Name"].Replace(".", "");
                pc.Ord        = Int32.Parse(collection["Ord"]);
                pc.Price_ship = float.Parse(collection["Price_ship"]);
                string parentLevel = collection["PriceCity"];
                pc.Level = parentLevel + "00000";

                db.sp_PriceCity_Update(pc.Id, pc.Name, pc.Level, pc.Ord, pc.Price_ship);
                db.SaveChanges();

                return(RedirectToAction("PriceCityIndex"));
            }
            else
            {
                return(Redirect("/Admins/admins"));
            }
        }