コード例 #1
0
        public void TestLayDanhSachMonHoc()
        {
            IMonHocService ims    = new MonHocService();
            string         error  = "";
            var            result = ims.LayDanhSachMonHoc(ref error);

            Assert.AreEqual(result.Count, 0, "Lỗi: TestLayDanhSachMonHoc: không trả về kết quả.");
        }
コード例 #2
0
        public HttpResponseMessage XemDanhSachMonHoc()
        {
            HttpResponseMessage respMsg;
            string errorMsg = "";

            IMonHocService ims = new MonHocService();
            var            lst = ims.LayDanhSachMonHoc(ref errorMsg);

            if (errorMsg != "")
            {
                respMsg = Request.CreateResponse(HttpStatusCode.InternalServerError,
                                                 JsonConvert.SerializeObject(new { msg = errorMsg, lst }));
            }
            else
            {
                respMsg = Request.CreateResponse(HttpStatusCode.OK,
                                                 JsonConvert.SerializeObject(new { lst }));
            }

            return(respMsg);
        }