Пример #1
0
        public ActionResult Cat_Edit(int id)
        {
            dbf522ec9140464818abf6a1c4013479aeEntities1 db = new dbf522ec9140464818abf6a1c4013479aeEntities1();

            if (Request.Cookies["Login"].Value.ToLower() == "true")
            {
                var q = from s in db.Categories
                        where s.Category_Id == id
                        select s;
                //Pro_Class product = new Pro_Class();

                foreach (var t in q)
                {
                    ViewBag.id = t.Category_Id;
                }
                return(View());
            }
            else
            {
                return(RedirectToAction("login", "Login"));
            }
        }
Пример #2
0
        public ActionResult Cat_Delete(int id)
        {
            dbf522ec9140464818abf6a1c4013479aeEntities1 db = new dbf522ec9140464818abf6a1c4013479aeEntities1();

            if (Request.Cookies["Login"].Value.ToLower() == "true")
            {
                var q = from s in db.Categories
                        where s.Category_Id == id
                        select s;
                foreach (var t in q)
                {
                    db.Categories.Remove(t);
                }
                db.SaveChanges();

                return(RedirectToAction("Index", "Category"));
            }
            else
            {
                return(RedirectToAction("login", "Login"));
            }
        }
Пример #3
0
        public ActionResult Edit(FormCollection c)
        {
            string name   = "";
            string detail = "";
            string longi  = "";
            string lat    = "";
            string image  = "default";

            name   = c["Name"];
            detail = c["Detail"];
            longi  = c["Longitude"];
            lat    = c["Latitude"];

            if (lat == String.Empty || longi == String.Empty || detail == String.Empty || name == String.Empty)
            {
                return(View("Edit"));
            }

            using (dbf522ec9140464818abf6a1c4013479aeEntities1 ctx = new dbf522ec9140464818abf6a1c4013479aeEntities1())
            {
                var q = from s in ctx.Places where s.Name == name select s;

                foreach (var t in q)
                {
                    t.Name = name;
                    ctx.SaveChanges();
                    t.Description = detail;
                    ctx.SaveChanges();
                    t.Longitude = longi;
                    ctx.SaveChanges();
                    t.Latitude = lat;
                    ctx.SaveChanges();
                    t.Image = image;
                    ctx.SaveChanges();
                }
            }
            return(RedirectToAction("location"));
        }
Пример #4
0
        public ActionResult Category_Display(FormCollection c)
        {
            if (Request["Category"] != "All")
            {
                int id = Convert.ToInt32(Request["Category"]);
                if (Request.Cookies["Login"].Value.ToLower() == "true")
                {
                    dbf522ec9140464818abf6a1c4013479aeEntities1 db = new dbf522ec9140464818abf6a1c4013479aeEntities1();

                    ViewBag.id = id;

                    return(View());
                }
                else
                {
                    return(RedirectToAction("login", "Login"));
                }
            }
            else
            {
                return(RedirectToAction("location", "Login"));
            }
        }