public ActionResult ThongTinThemCapNhat(string Id) { var duLieuOutput = new CommonPhongBan.PhongBanOutput.ThongTinPhongBan(); try { if (!string.IsNullOrEmpty(Id)) { var input = new CommonInput.DocThongTinInput { Id = Id }; var output = XuLyAPI.ApiJsonPost(APIUrl.PhongBan.DocThongTin, input) as CommonOutput; if (output == null) { throw new Exception(ConstantValues.Message.LoiServer); } if (output.KetQua != 1) { throw new Exception(output.ThongBao); } duLieuOutput = JsonConvert.DeserializeObject <CommonPhongBan.PhongBanOutput.ThongTinPhongBan>(output.DuLieu.ToString()); } } catch (Exception) { } return(PartialView("_ThemCapNhatPartial", duLieuOutput)); }
public ActionResult XuLyLuu(CommonPhongBan.PhongBanInput.ThongTinPhongBan input) { var model = new CommonOutput(); var input2 = new CommonPhongBan.PhongBanOutput.ThongTinPhongBan(); ViewBag.DanhSachViTri = StaticList.ViTriPhongBans(); ViewBag.DanhSachThuocTrang = StaticList.ThuocTrangs(); try { input2.Id = input.Id; input2.Ten = input.Ten; input2.MoTa = input.MoTa; input2.ThuTu = input.ThuTu; input2.KichHoat = input.KichHoat; input2.Ma = input.Ma; var url = !string.IsNullOrEmpty(input.Id) ? APIUrl.PhongBan.Sua : APIUrl.PhongBan.Them; var output = XuLyAPI.ApiJsonPost(url, input) as CommonOutput; if (output == null) { throw new Exception(ConstantValues.Message.LoiServer); } if (output.KetQua == 1) { model.KetQua = 1; model.ThongBao = ConstantValues.Message.ThanhCong; ViewBag.KetQua = 1; return(PartialView("_ThemCapNhatPartial", new CommonPhongBan.PhongBanOutput.ThongTinPhongBan())); } else { return(PartialView("_ThemCapNhatPartial", input2)); } } catch (Exception ex) { model.KetQua = 0; model.ThongBao = ConstantValues.Message.ThatBai; return(PartialView("_ThemCapNhatPartial", input2)); } }