Exemple #1
0
        public ActionResult DeleteTheRecord(Guid?id)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("LogIn", "Home"));
            }
            else
            if (((Model.User)Session["user"]).permission < (int)Model.User.PERMISSION.Admin)
            {
                return(RedirectToAction("Index", "Home"));
            }

            string where = null;
            List <string> cond = new List <string>();

            if (!id.Equals(null))
            {
                cond.Add($"Id='{id}'");
            }
            where = cond[0];
            List <Model.UrlInfo> allRecord = DAL.UrlInfo.Get(where);

            Model.UrlInfo model = new Model.UrlInfo();
            model.Id     = allRecord[0].Id;
            model.Region = allRecord[0].Region;
            model.Url    = allRecord[0].Url;
            return(View(model));
        }
Exemple #2
0
        public ActionResult DeleteTheRecord(String id)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("LogIn", "Home"));
            }
            else
            if (((Model.User)Session["user"]).permission < (int)Model.User.PERMISSION.Admin)
            {
                return(RedirectToAction("Index", "Home"));
            }

            string where = null;
            List <string> cond = new List <string>();

            if (id != null)
            {
                cond.Add($"Id='{id}'");
            }
            where = cond[0];
            Model.UrlInfo model = new Model.UrlInfo();
            if (DAL.UrlInfo.Delete(where) != 0)
            {
                return(RedirectToAction("EditUrl"));
            }
            return(View(model));
        }
Exemple #3
0
        public ActionResult AddOneRecord(Model.UrlInfo theModel)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("LogIn", "Home"));
            }
            else
            if (((Model.User)Session["user"]).permission < (int)Model.User.PERMISSION.Admin)
            {
                return(RedirectToAction("Index", "Home"));
            }

            Model.UrlInfo model = new Model.UrlInfo();
            if (model == null)
            {
                return(View());
            }
            if (theModel.Region == null || theModel.Url == null)
            {
                return(View());
            }
            model.Id     = theModel.Id;
            model.Region = theModel.Region;
            model.Url    = theModel.Url;
            if (DAL.UrlInfo.Add(model))
            {
                return(RedirectToAction("EditUrl"));
            }
            return(View());
        }