Example #1
0
        public ActionResult Edit(pb_HashTag model)
        {
            bn_HashTag bnHashTag = new bn_HashTag();

            string iconPath = (string)Session["IconPath"];

            if (iconPath == "" || iconPath == null)
            {
                iconPath = model.IconPath;
            }

            if (ModelState.IsValid)
            {
                bnHashTag.Update(
                    model.HashTagId,
                    model.Type,
                    iconPath,
                    model.Description,
                    model.UserTypes);

                //clear iconpath;
                Session["IconPath"] = null;

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Example #2
0
        public ActionResult Add()
        {
            pb_HashTag model = new pb_HashTag();

            model.UserId = ps_Membership.GetUser().UserId;

            return(View(model));
        }
Example #3
0
        public ActionResult Add(pb_HashTag model)
        {
            bn_HashTag bnHashTag = new bn_HashTag();
            string     iconPath  = (string)Session["IconPath"];

            if (iconPath != null)
            {
                model.IconPath = iconPath;
            }
            //Check image
            //if (iconPath == "" || iconPath == null)
            //{
            //    ViewBag.Message = "Phải có ít nhất một hình ảnh.";
            //    return View(model);
            //}

            //Check hashtag
            if (bnHashTag.IsExists(model.TagName))
            {
                ViewBag.Message = "This tag has been create, choose another one, please!";
                return(View(model));
            }

            if (ModelState.IsValid)
            {
                bnHashTag.Create(
                    model.UserId,
                    EHashtag_Type.Private,
                    model.TextName,
                    model.TagName,
                    model.Icon,
                    model.Description,
                    model.UserTypes);

                //clear iconpath;
                Session["IconPath"] = null;

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }