public ActionResult ThongTinThemCapNhatBaiViet(string Id) { var duLieuOutput = new Models.BaiVietModel.Output.ThongTin(); //if (string.IsNullOrEmpty(Id)) //{ // ViewBag.DanhSachPhongBan = DocDanhSachDonVi(); //} //else //{ // ViewBag.DanhSachNhomTin = DocDanhSachNhomTin(); //} ViewBag.DanhSachPhongBan = DocDanhSachDonVi(); ViewBag.DanhSachNhomTin = DocDanhSachNhomTin(); try { if (!string.IsNullOrEmpty(Id)) { var input = new CommonInput.DocThongTinInput { Id = Id }; var output = XuLyAPI.ApiJsonPost2(APIUrl.BaiVietChoLanhDao.DocThongTin, input) as CommonOutput; if (output == null) { throw new Exception(Message.LoiServer); } if (output.KetQua != 1) { throw new Exception(output.ThongBao); } duLieuOutput = JsonConvert.DeserializeObject <Models.BaiVietModel.Output.ThongTin>(output.DuLieu.ToString()); } } catch (Exception) { } return(PartialView("_ThemCapNhatBaiVietPartial", duLieuOutput)); }
public ActionResult XuLyLuuBaiViet(CommonBaiViet.Input.ThongTinBaiViet input) { TempData["returnUrl"] = Url.Action("BaiViet", "TinTucChoLanhDao", new { Areas = "TinTuc" }); //var kiemTra = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.BaiViet, QuyenHan.Ma.Them); //ViewBag.KetQua = kiemTra.KetQua; //if (kiemTra.KetQua < 0) return PartialView("_ThemCapNhatPartial", new CommonBaiViet.Output.ThongTin()); var userInfo = Session["UserInfo"] as CommonNguoiDung.NguoiDungOutput.DangNhapTaiKhoan; if (userInfo != null) { input.IdNguoiCapNhat = userInfo.Id; } var model = new CommonOutput(); var input2 = new Models.BaiVietModel.Output.ThongTin(); var DanhSachNhomTin = DocDanhSachNhomTin(); ViewBag.IdNhomTin = new SelectList(DanhSachNhomTin, "Value", "Text", "Ma"); try { input2.Id = input.Id; input2.TieuDe = input.TieuDe; input2.TieuDeRutGon = input.TieuDeRutGon; input2.DuongDan = input.DuongDan; input2.ThuTu = input.ThuTu; input2.NoiDungTomTat = input.NoiDungTomTat; input2.HinhDaiDien = input.HinhDaiDien; input2.MoTa = input.MoTa; input2.KichHoat = input.KichHoat; input2.TrangChu = input.TrangChu; input2.UuTien = input.UuTien; input2.NoiBat = input.NoiBat; input2.GioiHanThoiGian = input.GioiHanThoiGian; input2.NoiDung = input.NoiDung; input2.IdNhomTin = input.IdNhomTin; input2.TuKhoa = input.TuKhoa; input2.TieuDeSeo = input.TieuDeSeo; var url = !string.IsNullOrEmpty(input.Id) ? APIUrl.BaiVietChoLanhDao.Sua : APIUrl.BaiVietChoLanhDao.Them; var output = XuLyAPI.ApiJsonPost2(url, input) as CommonOutput; if (output == null) { throw new Exception(Message.LoiServer); } if (output.KetQua == 1) { model.KetQua = 1; model.ThongBao = Message.ThanhCong; ViewBag.KetQua = 1; return(PartialView("_ThemCapNhatBaiVietPartial", new Models.BaiVietModel.Output.ThongTin())); } else { return(PartialView("_ThemCapNhatBaiVietPartial", input2)); } } catch (Exception ex) { model.KetQua = 0; model.ThongBao = Message.ThatBai; return(PartialView("_ThemCapNhatBaiVietPartial", input2)); } }