public ActionResult BinhLuanSanPham()
 {
     var model = new BinhLuanSanPham();
     return PartialView("UpdateBinhLuanSanPham", model);
 }
 public ActionResult BinhLuanSanPham(int id, FormCollection collection)
 {
     if (Session["ID"] != null)
     {
         var model = new BinhLuanSanPham();
         model.QLSP_ID = id;
         model.TieuDe = collection["TieuDe"];
         model.NoiDung = collection["NoiDung"];
         model.Email = collection["Email"];
         model.NgayTao = DateTime.Now;
         model.AccountNguoiGoi_ID = 1;
         BLSPRes.Add(model);
         BLSPRes.Save();
         List<BinhLuanSanPhamViewModels> model1 = QLSPService.BinhLuanSanPham(model.QLSP_ID);
         return PartialView("ShowBinhLuanSanPham", model1);
     }
     else {
         return JavaScript("OnFailure();");
     }
 }
 public void Delete(BinhLuanSanPham dm)
 {
     en.DeleteObject(dm);
 }
        public ActionResult BinhLuanSanPham(int id, FormCollection collection)
        {
            if (Session["ID"] != null)
            {
                var model = new BinhLuanSanPham();
                if (TryUpdateModel(model))
                {
                    model.QLSP_ID = id;
                    model.TieuDe = collection["TieuDe"];
                    model.NoiDung = collection["NoiDung"];
                    model.Email = collection["Email"];
                    model.NgayTao = DateTime.Now;
                    model.AccountNguoiGoi_ID = int.Parse(Session["ID"].ToString());
                    BLSPRes.Add(model);
                    BLSPRes.Save();
                    ViewData["postSuccess"] = 1;
                    List<BinhLuanSanPhamViewModels> model1 = QLSPService.BinhLuanSanPham(id);
                    return Json(new { message = "FucssecFull", modelReturn = this.RenderPartialViewToString("ShowBinhLuanSanPham", model1) }, "text/html");

                }
                else {
                    return Json(new { message = "Validate", modelReturn = this.RenderPartialViewToString("UpdateBinhLuanSanPham", model) }, "text/html");
                }
            }
            else
            {
                return Json(new { message = "ErrorLogin", test = "test" });
            }
        }
 public void Add(BinhLuanSanPham dm)
 {
     en.AddObject("BinhLuanSanPham", dm);
 }