public ActionResult p_ProductTags(Guid productId) { bn_HashTag bnHashTag = new bn_HashTag(); var model = bnHashTag.GetByProductId(productId); return(View(model)); }
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)); }
// // GET: /Tag/ public ActionResult p_TagHeader(string tagName) { bn_HashTag bnHashTag = new bn_HashTag(); var model = bnHashTag.GetByTagName(tagName); bnHashTag.IncrViews(model.HashTagId); return(View(model)); }
public ActionResult AllTag(int page = 1) { bn_HashTag bnHashTag = new bn_HashTag(); int numberOfPage = 24; ViewBag.CountPage = (bnHashTag.GetCountAll() / numberOfPage) + 1; page = page > 0 ? page : 1; page = page < ViewBag.CountPage ? page : ViewBag.CountPage; ViewBag.page = page; var model = bnHashTag.GetListInPage(page, numberOfPage); return(View(model)); }
public ActionResult Index(Guid?userId) { if (!userId.HasValue) { userId = (Guid)ps_Membership.GetUser().UserId; } bn_HashTag bnHashTag = new bn_HashTag(); var model = bnHashTag.GetByUserId( (Guid)userId, EHashtag_Type.Private); return(View(model)); }
public ActionResult Edit(string tagName) { bn_HashTag bn_hashTag = new bn_HashTag(); var model = bn_hashTag.GetByTagName(tagName); //clear iconpath; Session["IconPath"] = null; if (model != null) { return(View(model)); } else { return(View(model)); } }
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)); }
public ActionResult List(Guid?tagId, string tagName = "juddy", int page = 0) { int itemsPerPage = 36; if (page < 0) { page = 0; } bn_Product bnProduct = new bn_Product(); List <pb_Product> model = new List <pb_Product>(); int tmpPages; if (!tagId.HasValue) { var tmpAll = bnProduct.GetByTagName(tagName).Count; tmpPages = tmpAll / itemsPerPage; if (tmpPages * itemsPerPage < tmpAll) { tmpPages++; } tmpPages--; if (page > tmpPages) { page = tmpPages; } model = bnProduct.GetByTagName(tagName) .Skip(page * itemsPerPage) .Take(itemsPerPage).ToList(); } else { var tmpAll = bnProduct.GetByHashTagId(tagId.Value).Count; tmpPages = tmpAll / itemsPerPage; if (tmpPages * itemsPerPage < tmpAll) { tmpPages++; } tmpPages--; if (page > tmpPages) { page = tmpPages; } bn_HashTag bnHashtag = new bn_HashTag(); tagName = bnHashtag.GetById(tagId.Value).TagName; model = bnProduct.GetByHashTagId(tagId.Value) .Skip(page * itemsPerPage) .Take(itemsPerPage).ToList(); } if (page > 0) { ViewBag.Back = "OK"; } else { ViewBag.Back = "Disable"; } if (page < tmpPages) { ViewBag.Next = "OK"; } else { ViewBag.Next = "Disable"; } ViewBag.CurrentPage = page; ViewBag.TagName = tagName; return(View("Index", model)); }