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 }); } }
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); }
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); }
public JsonResult BookUpdate(ENBook updatedBook) { try { updatedBook.Save(); return Json(new { Result = "OK" }); } catch (Exception ex) { return Json(new { Result = "ERROR", Message = ex.Message }); } }