示例#1
0
        public IHttpActionResult Posttbl_shop(tbl_shop tbl_shop)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tbl_shop.Add(tbl_shop);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (tbl_shopExists(tbl_shop.Shop_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tbl_shop.Shop_id }, tbl_shop));
        }
示例#2
0
        public IHttpActionResult Puttbl_shop(string id, tbl_shop tbl_shop)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_shop.Shop_id)
            {
                return(BadRequest());
            }

            db.Entry(tbl_shop).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tbl_shopExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public IHttpActionResult Gettbl_shop(string id)
        {
            tbl_shop tbl_shop = db.tbl_shop.Find(id);

            if (tbl_shop == null)
            {
                return(NotFound());
            }

            return(Ok(tbl_shop));
        }
示例#4
0
        public IHttpActionResult Deletetbl_shop(string id)
        {
            tbl_shop tbl_shop = db.tbl_shop.Find(id);

            if (tbl_shop == null)
            {
                return(NotFound());
            }

            db.tbl_shop.Remove(tbl_shop);
            db.SaveChanges();

            return(Ok(tbl_shop));
        }
示例#5
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            // Your logic here...
            tbl_header hea  = db.tbl_headers.SingleOrDefault(n => n.id == 1);
            tbl_shop   shop = db.tbl_shops.SingleOrDefault(n => n.id == 1);

            Session["icon"]     = hea.shortcuticon;
            Session["title"]    = shop.title;
            Session.Timeout     = 40;
            ViewBag.Title       = shop.title;
            ViewBag.icon        = hea.shortcuticon;
            ViewBag.keyword     = shop.keyword;
            ViewBag.shoptitle   = shop.title;
            ViewBag.description = shop.description;
            base.OnActionExecuting(filterContext);
        }
示例#6
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            Session.Timeout = 720;
            // Your logic here...
            tbl_header hea  = db.tbl_headers.SingleOrDefault(n => n.id == 1);
            tbl_shop   shop = db.tbl_shops.SingleOrDefault(n => n.id == 1);

            Session["icon"]             = hea.shortcuticon;
            Session["title"]            = shop.title;
            ViewBag.logo                = hea.image;
            ViewBag.Title               = shop.title;
            ViewBag.icon                = hea.shortcuticon;
            ViewBag.keyword             = shop.keyword;
            ViewBag.shoptitle           = shop.title;
            ViewBag.description         = shop.description;
            ViewBag.CurrentNumberFormat = new System.Globalization.CultureInfo("de-DE", false).NumberFormat;
            ViewBag.phone               = shop.phoneshop;
            base.OnActionExecuting(filterContext);
        }
示例#7
0
        public ActionResult shopInformationEdit(FormCollection form)
        {
            tbl_shop tic              = getShopInformation();
            var      tenshop          = form["tenshop"];
            var      emailshop        = form["emailshop"];
            var      phoneshop1       = form["phoneshop1"];
            var      thoigianlamviec1 = form["thoigianlamviec1"];
            var      addressshop      = form["addressshop"];
            var      thoigianlamviec2 = form["thoigianlamviec2"];
            var      phoneshop2       = form["phoneshop2"];
            var      longtitude       = form["longtitude"];
            var      lattitude        = form["lattitude"];


            var title       = form["title"];
            var description = form["description"];
            var keyword     = form["keyword"];

            tic.title       = title;
            tic.description = description;
            tic.keyword     = keyword;

            tic.tenshop          = tenshop;
            tic.emailshop        = emailshop;
            tic.phoneshop1       = phoneshop1;
            tic.thoigianlamviec1 = thoigianlamviec1;
            tic.thoigianlamviec2 = thoigianlamviec2;
            tic.addressshop      = addressshop;
            tic.phoneshop2       = phoneshop2;
            tic.longtitude       = longtitude;
            tic.lattitude        = lattitude;

            UpdateModel(tic);
            data.SubmitChanges();
            return(RedirectToAction("Index", "Admin"));
        }