示例#1
0
 public JsonResult BookCreate(ENBook newBook)
 {
     try
     {
         newBook.Save();
         return Json(new { Result = "OK", Record = newBook });
     }
     catch (Exception ex)
     {
         return Json(new { Result = "ERROR", Message = ex.Message });
     }
 }
示例#2
0
 public void BookUpdate()
 {
     var book = new ENBook();
     book = book.Read(1);
     var oldName = book.Name;
     book.Name = "testUpdateName";
     book.Save();
     var actual = book.Read(1);
     var actualName = actual.Name;
     actual.Name = oldName;
     actual.Save();
     Assert.AreEqual("testUpdateName", actualName);
 }
示例#3
0
 public void BookInsert()
 {
     var book = new ENBook();
     book.IdBook = "testInsertID";
     book.Name = "testInsertName";
     var testSubject = new ENSubject();
     testSubject = testSubject.Read(1);
     book.Subject = testSubject;
     book.Bussiness = (new ENBusiness()).Read(1);
     book.Save();
     var bookList = book.ReadAll();
     var actual = bookList[bookList.Count - 1];
     actual.Delete();
     Assert.AreEqual("testInsertID", actual.IdBook);
 }
示例#4
0
 public JsonResult BookUpdate(ENBook updatedBook)
 {
     try
     {
         updatedBook.Save();
         return Json(new { Result = "OK" });
     }
     catch (Exception ex)
     {
         return Json(new { Result = "ERROR", Message = ex.Message });
     }
 }