public ActionResult ThemCapNhatMenu(string id) { ViewBag.DanhSachDonVi = DocDanhSachDonVi(); var danhsach = DocDanhSach("", 0, 0); var data = new MenuModel.MenuOutput.ThemCapNhatMenu(); data.DanhSachMenu = danhsach.DanhSach; var thongtin = new MenuModel.MenuOutput.ThongTin(); var outputDanhMucChucNang = DocDanhMucChucNang(); if (outputDanhMucChucNang != null) { data.DanhMucChucNang = outputDanhMucChucNang.DanhSach; } if (!string.IsNullOrEmpty(id)) { var input = new CommonInput.DocThongTinInput(); input.Id = id; var output = XuLyAPI.ApiJsonPost(APIUrl.Menu.DocThongTin, input) as CommonOutput; if (output.KetQua == 1) { thongtin = JsonConvert.DeserializeObject <MenuModel.MenuOutput.ThongTin>(output.DuLieu.ToString()); data.ThongTinMenu = thongtin; } } return(PartialView("_PartialThemCapNhat", data)); }
public ActionResult XuLyLuu(CommonMenu.MenuInput.ThongTin input) { TempData["returnUrl"] = Url.Action("Index", "Menu", new { Areas = "Admin" }); var kiemTra = XuLyPhanQuyen.KiemTraQuyenTruyCap(ChucNang.Ma.QuangCao, QuyenHan.Ma.Them); ViewBag.KetQua = kiemTra.KetQua; if (kiemTra.KetQua < 0) { return(PartialView("_PartialThemCapNhat", new CommonMenu.MenuOutput.ThongTin())); } var danhsach = DocDanhSach("", 0, 0); var data = new MenuModel.MenuOutput.ThemCapNhatMenu(); data.DanhSachMenu = danhsach.DanhSach; var thongtin = new MenuModel.MenuOutput.ThongTin(); var outputDanhMucChucNang = DocDanhMucChucNang(); if (outputDanhMucChucNang != null) { data.DanhMucChucNang = outputDanhMucChucNang.DanhSach; } var model = new CommonOutput(); var input2 = new CommonMenu.MenuOutput.ThongTin(); try { input2.Id = input.Id; input2.Ten = input.Ten; input2.Ma = input.Ma; input2.Icon = input.Icon; input2.IdMenuCha = input.IdMenuCha; input2.LienKet = input.LienKet; input2.Nhom = input.Nhom; input2.Loai = input.Loai; input2.ViTri = input.ViTri; input2.KichHoat = input.KichHoat; input2.MoTa = input.MoTa; input2.BieuTuong = input.BieuTuong; input2.KieuHienThi = input.KieuHienThi; var url = !string.IsNullOrEmpty(input.Id) ? APIUrl.Menu.CapNhat : APIUrl.Menu.Them; var output = XuLyAPI.ApiJsonPost(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("_PartialThemCapNhat", data)); } else { ViewBag.KetQua = 0; data.ThongTinMenu = input2; return(PartialView("_PartialThemCapNhat", data)); } } catch (Exception ex) { ViewBag.KetQua = 0; model.KetQua = 0; model.ThongBao = Message.ThatBai; return(PartialView("_PartialThemCapNhat", input2)); } }