Ejemplo n.º 1
0
        public JsonResult AddFeedbackPartial(string newFeedback)
        {
            var feedback = new JavaScriptSerializer().Deserialize <feedback>(newFeedback);

            if (feedback != null)
            {
                if (Session["id"] != null)
                {
                    feedback.user_id    = int.Parse(Session["id"].ToString());
                    feedback.start_time = DateTime.Now;
                    feedback.status     = true;
                    var created = new FeedbacksModel().create(feedback);
                    if (created)
                    {
                        return(Json(
                                   new { status = true }
                                   ));
                    }
                }
                else
                {
                    Session["url"] = Request.UrlReferrer.ToString();
                    return(Json(new { yetLogin = true }));
                }
            }
            return(Json(
                       new { status = false }
                       ));
        }
Ejemplo n.º 2
0
        // GET: Common
        public PartialViewResult RatingStar(int id)
        {
            ViewBag.id            = id;
            ViewBag.totalFeedback = new FeedbacksModel().getTotalFeedbackByProductId(id);
            float totalRate = new FeedbacksModel().getTotalFeedbackByProductId(id);
            float totalStar = new FeedbacksModel().getTotalStarByProductId(id);

            ViewBag.AvgStar = float.IsNaN(totalStar / totalRate) ? 0 : (totalStar / totalRate);
            return(PartialView());
        }
Ejemplo n.º 3
0
        public JsonResult ChangeStatusById(int id)
        {
            var changed = new FeedbacksModel().changeStatusById(id);

            if (changed)
            {
                return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public ActionResult View(int id)
        {
            var feedback = new FeedbacksModel().getFeedbackById(id);

            if (feedback == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(feedback));
        }
Ejemplo n.º 5
0
        public ActionResult DetailProduct(int id)
        {
            new ProductsModel().updateViewByProductId(id);
            var detailProduct = new ProductsModel().getProductById(id);

            ViewBag.totalFeedback = new FeedbacksModel().getTotalFeedbackByProductId(id);
            float totalRate = new FeedbacksModel().getTotalFeedbackByProductId(id);
            float totalStar = new FeedbacksModel().getTotalStarByProductId(id);

            ViewBag.AvgStar = float.IsNaN(totalStar / totalRate) ? 0 : (totalStar / totalRate);
            return(View(detailProduct));
        }
Ejemplo n.º 6
0
        public JsonResult Delete(int id)
        {
            var deleted = new FeedbacksModel().deleteById(id);

            if (deleted)
            {
                return(Json(
                           new
                {
                    status = true
                }
                           ));
            }
            return(Json(
                       new
            {
                status = false
            }
                       ));
        }
Ejemplo n.º 7
0
        public string GetNameProductById(int id)
        {
            var productName = new FeedbacksModel().getNameProductById(id);

            return(productName);
        }
Ejemplo n.º 8
0
        public string GetNameUserById(int id)
        {
            var userName = new FeedbacksModel().getNameUserById(id);

            return(userName);
        }
Ejemplo n.º 9
0
        public PartialViewResult DisplayFeedbackPartial(int id, int?page)
        {
            var feedbacks = new FeedbacksModel().GetFeedbacksClientByProductId(id, page);

            return(PartialView(feedbacks));
        }
Ejemplo n.º 10
0
        // GET: Dashboard/Feedback
        public ActionResult Index()
        {
            var feedbacks = new FeedbacksModel().getFeedbacks();

            return(View(feedbacks));
        }