public void GetAdmin() { var repository = new AdminList(); var newAdmin = new Admin() { Name = "Jimi Hendrix", StreetAddress = "12th Ave", City = "Minneapolis", State = "MN", ZipCode = "12446" }; var newAdminId = repository.AddAdmin(newAdmin); Assert.IsTrue(null != newAdminId, "addition fail"); var admin = repository.GetAdmin(newAdminId.Value); Assert.IsTrue(null != admin, "get new admin failed."); Assert.AreEqual(newAdmin.Name, admin.Name, "name are not equal."); Assert.AreEqual(newAdmin.StreetAddress, admin.StreetAddress, "address are not equal."); Assert.AreEqual(newAdmin.City, admin.City, "city are not equal."); Assert.AreEqual(newAdmin.State, admin.State, "state are not equal."); Assert.AreEqual(newAdmin.ZipCode, admin.ZipCode, "zip code are not equal."); var success = repository.DeleteAdmin(newAdminId.Value); Assert.IsTrue(success, "delete admin failed."); }
public JsonResult DeleteAdmin(AdminDBModel _dbModel) { int _result = 0; objList = new AdminList(); _result = objList.DeleteAdmin(_dbModel); if (_result > 0) { return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public void DeleteAdmin() { var repository = new AdminList(); var newAdmin = new Admin() { Name = "Jimi Hendrix", StreetAddress = "12th Ave", City = "Minneapolis", State = "MN", ZipCode = "12446" }; var newAdminId = repository.AddAdmin(newAdmin); Assert.IsTrue(null != newAdminId, "addition fail"); var admin = repository.GetAdmin(newAdminId.Value); Assert.IsTrue(null != admin, "get new admin failed."); var success = repository.DeleteAdmin(newAdminId.Value); Assert.IsTrue(success, "delete admin failed."); }